Say we want to render a cube. To draw a geometry we need only 8 vertices. Is it true that in case we need to map textures we need 24 vertices, i.e. we must submit redundant vertices?
Thanx
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since these vertices have different properties they are not the same. So yes, some data may be redundant but not all of it. Normally indexed geometry could be used when vertices are shared between faces, but in this case they are not really shared.
OpenGL provides vertex array functionality which could be used to separate bits of vertex data into independent chunks. Let’s say you can have coordinates in one consecutive array, colors in another and texture coordinates and in the third. Vertex data doesn’t have to be interleaved. See
glVertexPointer,glColorPointer,glTexCoordPointerand etc.Using vertex arrays you could save some memory by sharing some of the vertex data, but that would require to make many draw calls and would not be worth it for this simple case of a cube. This article could be quite useful, check it out.