hi there!
im trying to get my heightmap to be rendered with vertex arrays, using glDrawElements…
well my problem is that everything is ok, except the terrain doesnt show up with i do this code…
well im new to this here, so i dunno what can be wrong…
VertexArray is an array of floats: [Landscape.mapWidth * Landscape.mapHeight * 3];
IndexArray is an array of unsigned ints: [Landscape.mapWidth * Landscape.mapHeight * 3 * 2];
(this holds the indices of the 2 triangles that makes each tile in the terrain)
well anyone have any idea? i’ve seen some code around on this, but didnt help much…
this might have sum stupid code, but well im trying this without any info… cant find any that tells me what these funcs really do
glEnableClientState(GL_VERTEX_ARRAY);
glLockArraysEXT(0, Landscape.mapWidth * Landscape.mapHeight * 2); // lock vertex arrays
glDisable(GL_CULL_FACE);
glDisable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
glDisable(GL_FOG);
glColor4f(1,1,1,1);
glVertexPointer(3, GL_FLOAT, 0, Landscape.VertexArray);
glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, Landscape.IndexArray);
glEnable(GL_TEXTURE_2D);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_FOG);
glUnlockArraysEXT(); // unlock vertex arrays
glDisableClientState(GL_VERTEX_ARRAY);