float xyz[3] ; // x,y,z of the vertex (modified)
float nxyz[3] ; // x,y,z of the vertex (never modified)
float tex[2] ; // 2D texture index
int np ; // number of polygons associated with node
int plist[30] ; // list of polygons associated with node
float norm[3] ; // polygon vertex normal
float anorm[3] ; /* average vertex normal */
} VERTEX ;
typedef struct POLYGON {
VERTEX *vertex[3] ; // pointer to an array of three vertices
but the numbers of polygons is huge, so i’d like to use the vertex array extension, but in the glVertexpointer i need to know the stride thing, how can i calculate the bytes?
please help.
thanks
In order to use “glVertexPointer(…)”, you’ll need to clean-up some of your data structures. First, all your vertices must be in a single, contiguous array. Try this:
Then you can call:
“glVertexPointer(3, GL_FLOAT, sizeof(VERTEX), polygon[0].vertex[0].xyz );”
If you try to use:
typedef struct POLYGON{
VERTEX* vertex[3];
};
Then each of your data elements (ie. VERTEX structures) will be allocated individually in heap memory instead of in a contiguous array.
Hi again, what BritC says make sense but somehow it doesn’t work, i’ll have to make the vertex array without the VERTEX struct. please if you figure out something, please let me know thanks for your help.