I’m calling:
glVertexPointer(3,GL_FLOAT,0,Vertices);
glNormalPointer(GL_FLOAT,0,Normals);
glTexCoordPointer(2,GL_FLOAT,0,TexCoords);
But keep getting segfaults. The sizes for all the arrays have to be the same don’t they ? So if I have a 4X4 grid that means 16 verts 16 Normals (Vert Norms) and 16 Tex Coords - one for each vert ? I have a struct for each aray:
typedef struct // for Verts and Norms and tris
{
Glfloat x;
GLfloat y;
GLfloat z;
}VEC;
typedef struct // for Tex
{
Glfloat u;
GLfloat v;
}TEX;
Can I create an array of these types :
VEC vecArray[MAXVERTS];
and put my values in there? or are you not to use User defined types and just put the vert x,y,z into a normal 1D array sequentially
float vecArray[MAXVERTS]
What about drawing Triangles ?
glDrawElements(GL_TRIANGLES,numTriangles,GL_FLOAT,Triangles);
If I fill my triangle array, does numTriangles become 18 for a 4x4 vert grid ? or numverts * 3 (Which I’ve seen done…if numverts is 16)
Regards