PDA

View Full Version : glDrawElements confusion



mcbastian
01-03-2005, 10:49 PM
Hey!

just a short question about glDrawElements.

I want to render an array of triangles. using a unsigned int* buffer where the indices are stored in.

so, I have an array of vertices, glVertexPointer it and then I'll draw it with glDrawElements.

is it like:
unsigned int* facebuffer;
.....
glDrawElements(GL_TRIANGLES, number_of_faces, GL_UNSIGNED_INT, facebuffer)

or is it:

glDrawElements(GL_TRIANGLES, number_of_faces*3, GL_UNSIGNED_INT, facebuffer)

????

:confused:

thanks for help!

mikael_aronsson
01-03-2005, 11:37 PM
Hi !

It's the number of elements to render, not the number of vertices, look at it as if you where calling glArrayElement() in a loop where element count is the number of times to run the loop.

Mikael

mcbastian
01-03-2005, 11:54 PM
yeah. but is the number of elements the number of triangles I have or the number of indices in total? (for a triangle: number of triangles * 3)

Aeluned
01-04-2005, 02:59 AM
It's the number of indices in total.