I have this code for dropping points. I want to increase the point size. Right now I use this command glPointSize
but nothing happens. The point size is default. It does not increase.
How can I increase my point size?
glBegin(GL_POINTS);
glColor3f (a, b, c);
glPointSize(20.0f);
glVertex2i(px, py);
glEnd();
The glPointSize function specifies the rasterized diameter of both aliased and antialiased points. Using a point size other than 1.0 has different effects, depending on whether point antialiasing is enabled. Point antialiasing is controlled by calling glEnable and glDisable with argument GL_POINT_SMOOTH.
You can change this size with the function glPointSize: void glPointSize(GLfloat size); The glPointSize function takes a single parameter that specifies the approximate diameter in pixels of the point drawn. Not all point sizes are supported, however, and you should make sure the point size you specify is available.
glPointSize(20.0f);
has to be put before glBegin()
, otherwise it won't have any effect. Do it like this:
glPointSize(20.0f);
glBegin(GL_POINTS);
glColor3f (a, b, c);
glVertex2i(px, py);
glEnd();
In OpenGL documentation, you can read that:
Only a subset of GL commands can be used between glBegin and glEnd. The commands are glVertex, glColor, glIndex, glNormal, glTexCoord, glEvalCoord, glEvalPoint, glArrayElement, glMaterial, and glEdgeFlag. Also, it is acceptable to use glCallList or glCallLists to execute display lists that include only the preceding commands. If any other GL command is executed between glBegin and glEnd, the error flag is set and the command is ignored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With