This topic is now archived and is closed to further replies.

Fish HF

vertex array tutorials

Recommended Posts

is there any tutorials on vertex arrays? i''m currrently using the lists to draw stuff, but i need to do multitexturing, so it looks like i need to move to vertex arrays thanks

Share this post

Link to post
Share on other sites
I believe the heightmap demo''s on game tutorials uses vertex arrays for rendering. It''s not difficult though. Basically it''s:

//create the arrays

float VertexArray[64*3]; //array for 64 vertices (3 floats per vertex)

float TexArray[64*2]; //array for 64 vertex texCoords (2 coords per vertex)

//store some data in it

//tell OpenGL where to find the stuff

glVertexPointer(3, GL_FLOAT, 0, VertexArray);
glTexCoordPointer(2, GL_FLOAT, 0, TexArray);
//tell OpenGL to render a 64 vertex triangle strip

glDrawArrays(GL_TRIANGLE_STRIP, 64);

This is just off the top of my head so you might want to check the OpenGL docs for the exact syntax.

Sander Maréchal
[Lone Wolves Game Development][RoboBlast][Articles][GD Emporium][Webdesign][E-mail]

GSACP: GameDev Society Against Crap Posting
To join: Put these lines in your signature and don''t post crap!

Share this post

Link to post
Share on other sites