Skip to main content
gamedev.net
🔒 Locked

vertex array tutorials

Started by Fish HF 0 replies 300+ views
Original Post
Fish HF
Fish HF
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
Sander
Sander
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

FillArraysWithData();
//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!

Topic Locked

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

Sign in to reply to this topic.