GLPROVOKINGVERTEX(3G)

✨ GLPROVOKINGVERTEX πŸ’…

okay so real talk β€” this is a page from the 3G manual (that's the OpenGL one, iykyk), and it's about glProvokingVertex. yes the name is a lot. no i will not be explaining why it's called that. let's go 🫢


🌸 NAME 🌸

glProvokingVertex β€” specifiy the vertex to be used as the source of data for flat shaded varyings

(that "specifiy" is the manpage's own spelling bestie, i'm just the messenger 😭)


🌈 C SPECIFICATION 🌈

void glProvokingVertex(GLenum provokeMode);

πŸŽ€ PARAMETERS πŸŽ€

  • provokeMode β€” Specifies the vertex to be used as the source of data for flat shaded varyings.

πŸ’– DESCRIPTION πŸ’–

so like. flatshading a vertex shader varying output means you assign all vetices of the primitive the same value for that output. (again: "vetices". not me. the manpage. πŸ’€)

the vertex from which these values is derived is known as the provoking vertex, and glProvokingVertex specifies which vertex is to be used as the source of data for flat shaded varyings. it's literally picking the main character of the primitive, the one whose values get broadcast to everybody else. main character energy, fr fr.

provokeMode must be either GL_FIRST_VERTEX_CONVENTION or GL_LAST_VERTEX_CONVENTION, and controls the selection of the vertex whose values are assigned to flatshaded varying outputs. the interpretation of these values for the supported primitive types is:

  • point β€” First Vertex Convention: i / Last Vertex Convention: i
  • independent line β€” First Vertex Convention: 2i - 1 / Last Vertex Convention: 2i
  • line loop β€” First Vertex Convention: i / Last Vertex Convention:
i + 1, if i < n
.PP
1, if i = n

(no babe, that .PP is not me being quirky, it's genuinely sitting there in the middle of the table in the source. iconic behaviour honestly 🌸)

  • line strip β€” First Vertex Convention: i / Last Vertex Convention: i + 1
  • independent triangle β€” First Vertex Convention: 3i - 2 / Last Vertex Convention: 3i
  • triangle strip β€” First Vertex Convention: i / Last Vertex Convention: i + 2
  • triangle fan β€” First Vertex Convention: i + 1 / Last Vertex Convention: i + 2
  • line adjacency β€” First Vertex Convention: 4i - 2 / Last Vertex Convention: 4i - 1
  • line strip adjacency β€” First Vertex Convention: i + 1 / Last Vertex Convention: i + 2
  • triangle adjacency β€” First Vertex Convention: 6i - 5 / Last Vertex Convention: 6i - 1
  • triangle strip adjacency β€” First Vertex Convention: 2i - 1 / Last Vertex Convention: 2i + 3

If a vertex or geometry shader is active, user-defined varying outputs may be flatshaded by using the flat qualifier when declaring the output. slay.


πŸ¦‹ NOTES πŸ¦‹

glProvokingVertex is available only if the GL version is 3.2 or greater. like, don't come crying to me if you're on 3.1, i warned you πŸ’…


πŸ”₯ ERRORS πŸ”₯

  • GL_INVALID_ENUM is generated if provokeMode is not an accepted value.

that's it. that's the whole error list. it's giving minimalist.


πŸ‘‘ VERSION SUPPORT πŸ‘‘

okay so this is the whole "can i use it" chart, and yes it is literally all dashes until 3.2 shows up and saves the day. the column header is OpenGL Version, the row is the Function / Feature Name β€” which is, obvi, glProvokingVertex:

  • OpenGL 2.0 β€” -
  • OpenGL 2.1 β€” -
  • OpenGL 3.0 β€” -
  • OpenGL 3.1 β€” -
  • OpenGL 3.2 β€” βœ”
  • OpenGL 3.3 β€” βœ”
  • OpenGL 4.0 β€” βœ”
  • OpenGL 4.1 β€” βœ”
  • OpenGL 4.2 β€” βœ”
  • OpenGL 4.3 β€” βœ”
  • OpenGL 4.4 β€” βœ”
  • OpenGL 4.5 β€” βœ”

🧚 SEE ALSO 🧚

bestie. it's empty. there is nothing here. the section exists and then it just… doesn't. i'm not gonna make up references, that's not the vibe. consider this the void section. πŸ•³οΈ


Copyright Β© 2010-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.


Copyright Β© 2010-2014 Khronos Group


okay that's the whole page, go forth and flatshade responsibly πŸ“

mwah πŸ’‹ β€” this lil rendition came from the source tag [FIXME: source] (yes, that's literally what it says, we love an unfinished placeholder) and it's dated 08/09/2021. catch you in the next one, bestie πŸŽ€βœ¨

πŸ“¦ where this page comes from