Kojot

10-20-2010, 04:28 AM

Let's say I have:

GLfloat vertices[] = {...}; // 8 of vertex coords

GLubyte indices[] = {0,1,2,3, // 24 of indices

0,3,4,5,

0,5,6,1,

1,6,7,2,

7,4,3,2,

4,7,6,5};

I use glDrawElements() function to render GL_QUADS and everything is ok.

But what if I want to add normal array to my object? What structure does it have to be?

3 floats for every index (one Normal for every Vertex)?

or 3 floats for every 4 of indexes (one Normal for every Quad) ?

Or should I use glDrawElements() function not once, but for every Quad separetely, giving property amount of indices?

GLfloat vertices[] = {...}; // 8 of vertex coords

GLubyte indices[] = {0,1,2,3, // 24 of indices

0,3,4,5,

0,5,6,1,

1,6,7,2,

7,4,3,2,

4,7,6,5};

I use glDrawElements() function to render GL_QUADS and everything is ok.

But what if I want to add normal array to my object? What structure does it have to be?

3 floats for every index (one Normal for every Vertex)?

or 3 floats for every 4 of indexes (one Normal for every Quad) ?

Or should I use glDrawElements() function not once, but for every Quad separetely, giving property amount of indices?