Reputation: 6193
First of all: yes, I know this is a really outdated programming interface. But some target machines don't even guarantee OpenGL 2.1, that's why it still has to be used.
My problem: when drawing some geometries with OpenGL, points and polylines that consist of 2 points only are not drawn. Is there a polyline with at least three coordinate points, it works smoothly. So this is not working:
glBegin(GL_POINT);
glVertex3f(...);
glEnd();
glBegin(GL_LINE_STRIP);
glVertex3f(...);
glVertex3f(...);
glEnd();
...while this creates results as expected:
glBegin(GL_LINE_STRIP);
glVertex3f(...);
glVertex3f(...);
glVertex3f(...);
...
glEnd();
This is my initialisation:
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
glShadeModel(GL_SMOOTH);
glHint( GL_POINT_SMOOTH_HINT, GL_NICEST );
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-0.5f, 0.5f, -0.5f, 0.5f, 1.0f, 1000.0f);
Any idea what the reason for this behaviour is? Why are simple lines and dots not drawn?
Upvotes: 0
Views: 2089
Reputation: 633
Try GL_POINTS
rather than GL_POINT
. GL_POINTS
is a sort of Enumeration that tells OpenGL to render points. I believe GL_POINT
is used to modify the rendering mode (render solid polygons (GL_FILL
), render wireframe polygons (GL_LINE
), or render disconnected vertices of polygons (GL_POINT
)). I wanted to clarify before but could not think of a good way to explain it at the time.
Upvotes: 2