I'm getting into OpenGL. I'm following learnopengl.com and I reached the text rendering part, where I read (at the end of In Practice > Text Rendering > Shaders section)
The 2D quad requires 6 vertices of 4 floats each, so we reserve 6 * 4 floats of memory. Because we'll be updating the content of the VBO's memory quite often we'll allocate the memory with GL_DYNAMIC_DRAW.
So far I was thinking of a quad as a pair of triangles, four vertex. How a quad can require 6 vertex?
If a quad contains 2 triangles it can take 6 vertices, 2 vertices will be the duplicated in this case.
Alternatively, you can use 4 vertices and
GL_TRIANGLE_STRIP. All vertices will be unique, no duplicates.Alternatively, there is a trick with only one triangle, 3 vertices only. Vertex shader would look like:
And a discussion what pros and cons have these methods.