Legacy (immediate mode)GL 1.0
glVertex2f
glVertex3f for 2D: emits a vertex at (x, y) with z = 0.
Part of the family glVertex*
Removed from the core profile. Part of the legacy immediate mode, removed from the core profile in OpenGL 3.2. Shown here only so you can recognize it in old tutorials — use VBOs and VAOs instead.
Signature
void glVertex2f(GLfloat x, GLfloat y);
How it works
The suffix tells the shape of the arguments, a naming scheme modern OpenGL kept: 2f = two floats, 3f = three floats, 3fv = a pointer to three floats. glUniform2f follows the same rule.
Parameters
xGLfloat
X coordinate.
yGLfloat
Y coordinate.
Example
example.cpp
1glBegin(GL_TRIANGLES);
2 glVertex2f(-0.5f, -0.5f);
3 glVertex2f( 0.5f, -0.5f);
4 glVertex2f( 0.0f, 0.5f);
5glEnd();