GLVERTEX(3G)
π GLVERTEX β specify a vertex π
okay bestie, welcome to glVertex (from the 3G manual, the OpenGL girlies know π
). This is the function that literally draws the dots. Every point, every line, every polygon you've ever seen in an OpenGL app? Somebody called glVertex for that. No cap.
β¨ NAME β¨
So like, there's not one glVertex, there's a whole squad of them. Twenty-four of them, to be exact. Here's the full roster, fr fr:
glVertex2d, glVertex2f, glVertex2i, glVertex2s, glVertex3d, glVertex3f,
glVertex3i, glVertex3s, glVertex4d, glVertex4f, glVertex4i, glVertex4s,
glVertex2dv, glVertex2fv, glVertex2iv, glVertex2sv, glVertex3dv,
glVertex3fv, glVertex3iv, glVertex3sv, glVertex4dv, glVertex4fv,
glVertex4iv, glVertex4sv - specify a vertex
π C SPECIFICATION π
The take-the-numbers-directly version. First batch, all lined up pretty:
void glVertex2d( GLdouble x,
GLdouble y )
void glVertex2f( GLfloat x,
GLfloat y )
void glVertex2i( GLint x,
GLint y )
void glVertex2s( GLshort x,
GLshort y )
void glVertex3d( GLdouble x,
GLdouble y,
GLdouble z )
void glVertex3f( GLfloat x,
GLfloat y,
GLfloat z )
void glVertex3i( GLint x,
GLint y,
GLint z )
void glVertex3s( GLshort x,
GLshort y,
GLshort z )
void glVertex4d( GLdouble x,
GLdouble y,
GLdouble z,
GLdouble w )
void glVertex4f( GLfloat x,
GLfloat y,
GLfloat z,
GLfloat w )
void glVertex4i( GLint x,
GLint y,
GLint z,
GLint w )
void glVertex4s( GLshort x,
GLshort y,
GLshort z,
GLshort w )
πΈ PARAMETERS πΈ
x,y,z,wβ these are the x, y, z, and w coordinates of a vertex, bestie. That's the whole personality. And lowkey important: not all parameters are present in all forms of the command β like,glVertex2fonly got handedxandy, she's doing her best π.
π¦ C SPECIFICATION π¦
okay now the pointer girlies. Same energy, but you hand over an array instead of vibing with individual numbers:
void glVertex2dv( const GLdouble *v )
void glVertex2fv( const GLfloat *v )
void glVertex2iv( const GLint *v )
void glVertex2sv( const GLshort *v )
void glVertex3dv( const GLdouble *v )
void glVertex3fv( const GLfloat *v )
void glVertex3iv( const GLint *v )
void glVertex3sv( const GLshort *v )
void glVertex4dv( const GLdouble *v )
void glVertex4fv( const GLfloat *v )
void glVertex4iv( const GLint *v )
void glVertex4sv( const GLshort *v )
π PARAMETERS π
vβ a pointer to an array of two, three, or four elements. It's giving β¨choose your own adventureβ¨. The elements of a two-element array arexandy; of a three-element array,x,y, andz; and of a four-element array,x,y,z, andw. Iconic, honestly. π
π DESCRIPTION π
So the tea β: glVertex commands are used within glBegin/glEnd pairs to specify point, line, and polygon vertices. That's their whole job, and they ate. π₯
The current color, normal, and texture coordinates are associated with the vertex when glVertex is called. So like, whatever state you've set up right at that moment? That's what gets stapled to that vertex. Timing is everything, periodt. π
And the defaults, because y'all always ask:
- When only
xandyare specified,zdefaults to0andwdefaults to1. - When
x,y, andzare specified,wdefaults to1.
β οΈ NOTES β οΈ
π¨ bestie listen to me. InvokingglVertexoutside of aglBegin/glEndpair results in undefined behavior. Not a warning, not a gentle suggestion β undefined behavior. That's the scary one. Do not do it. That's it, that's the note. π
π«Ά SEE ALSO π«Ά
Go read her friends, they're all slaying in their own lanes:
glBegin(3G)glCallList(3G)glColor(3G)glEdgeFlag(3G)glEvalCoord(3G)glIndex(3G)glMaterial(3G)glNormal(3G)glRect(3G)glTexCoord(3G)glVertexPointer(3G)
and that's the whole page, bestie!! πβ¨ this one lives in the GLVERTEX(3G) section of the manual β yeah, same name top and bottom, she's consistent like that π
β so go forth, call your vertices inside your glBegin/glEnd pairs, and stay undefined-behavior-free. mwah π«Άπ
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- fedora 43: gl-manpages 1.1-34.20190306.fc43 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- fedora 44: gl-manpages 1.1-35.20190306.fc44 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms