Jump to content
  • Advertisement
Sign in to follow this  
lanhaiou

OpenGL how to use glVertexPointer

This topic is 2205 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

Hi,
I am pretty new to OPENGL, and could any one help me ? thanks !!

I have a texture which contains number of tiles (each tile is part of this texture).
now I want to draw all the tiles in one draw call : glDrawElements(), (every tile's vertex coordination is different).
something like:

glVertexPointer(); //set the vertex array,
glTexCoordPointer(); //set the coordinations of the tile in texture.
glDrawElements();

do I have to call glTexCoordPointer() to set the coordinations for every tile ? that will be 3 times call of above code if I want to draw 3 tiles.
is there any efficient way to handle that ?

thank you very much !!

Share this post


Link to post
Share on other sites
Advertisement
You can put your data in one large array and just setup the pointers once. One call to glVertexPointer and one to glTexCoordPointer.
A more efficient way would be to move up to GL 1.5 and start using VBO so that your vertices will be in video memory rather than local RAM.

Share this post


Link to post
Share on other sites
Sign in to follow this  

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