Skip to main content
gamedev.net
🔒 Locked

vertex array

Started by Metal Typhoon May 22, 2003 at 1:31 PM 4 replies 350+ views
Original Post
Metal Typhoon
Metal Typhoon
where can i find a good tutorial to render a heightmap using this ? i''m really tired of using glVertex calls thx alot
Metal Typhoon
FantasticDan
FantasticDan
buy "OpenGL Game Programming" by the GameDev guys, you find a tutorial on heightmaps and vertex arrays there if you dont have the money, maybe this will help you:

http://www.cs.rit.edu/~ncs/Courses/570/UserGuide/OpenGLonWin-15.html#HEADING15-29
..FantasticDan
Metal Typhoon
Metal Typhoon
quote:
Original post by FantasticDan
buy "OpenGL Game Programming" by the GameDev guys, you find a tutorial on heightmaps and vertex arrays there if you dont have the money, maybe this will help you:

http://www.cs.rit.edu/~ncs/Courses/570/UserGuide/OpenGLonWin-15.html#HEADING15-29


i had a looka at that. let me see if i understood..

to declare the array

float Vertices[] = {alot of numbers};

glVertexPointer (3,GL_FLOAT, can u explain this ?,Vertices);
glEnableClientState (GL_VERTEX_ARRAY);
glDrawArrays(GL_TRIANGLE_STRIP,map size,Vertices, what should be here ?);

if i''m mistaken please correct me
Metal Typhoon
leinad
leinad
void glVertexPointer(GLint size, GLenum TYPE, GLsizei stride, TYPE* array_name);

Where:
size = no. of components per vert (x+y+z = 3)
TYPE = data type of values (usually float)
stride = number of array indices between vertices
(comes in handy with interleaved arrays, but for just verts: pass in 0):

vertex_array[0..1..2..3..4..5..6..7..8..9..10..i-1]
;;;;;;;;;;;;;x0.y0.z0.{stride=4}..x1.y1.z1.{repeating}..x2...
FantasticDan
FantasticDan
yea if your vertices a tightly packed you simply can pass 0 .. but if your vertices are stores in structs (for example..) like this:

struct v3
{
float x,y,z;
float r,g,b;
int anything;
};

then stride would be "sizeof(v3)" because there is data you don''t need and opengl needs to know if there''s crap inside
..FantasticDan

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.