I have a vector class which I use to store my vertex and normal positions. It's only member variables are three, standard floats. Can I use this class when building my vertex arrays?
I have the following struct:
struct _triangle_vertex
{
vector normal;
vector vertex;
} *vertices;
As expected, sizeof(_triangle_vertex) = 24. Now, I construct a unique list of _triangle_vertices (based on my mesh) and dereference that list into an indexed array (named index), and the two of them are sufficient to draw the object mesh. But when I attempt to load the data into a vertex array, nothing draws. This is what I use to fill the lists:
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glNormalPointer(GL_FLOAT, 6*sizeof(float), &vertices[0].normal);
glVertexPointer(3, GL_FLOAT, 6*sizeof(float), &vertices[0].vertex);
And I simply call glDrawElements(GL_TRIANGLES, numTriangles* 3, GL_UNSIGNED_INT, index) in render. The object draws ok, but it is completely unlit (black). Have I filled the arrays imporperly? Or perhaps the use of the vector object is causing problems? I'm fairly certain the normals are correct, though that is the only other thing I think it could be.
Thanks in advance.
[Edited by - CyberSlag5k on March 1, 2005 4:11:22 PM]
Without order nothing can exist - without chaos nothing can evolve.