Jump to content
  • Advertisement

Archived

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

Fish HF

vertex array tutorials

This topic is 5459 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!