Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Mar 2012
Offline Last Active Aug 05 2012 08:32 AM

Topics I've Started

how to use glVertexPointer

05 August 2012 - 08:32 AM

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.

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

is glBindTexture() not efficency ?

19 March 2012 - 05:19 AM


I am trying to write a tile based 2D game using openGL, and I'm new to openGL..
I heard that glBindTexture() is not efficency and we'd better to bind texture only one time and drawing all the staff using this texture(this texture

constains all the tiles we need).
so I have 2 questions, could anybody help? thanks very much!
1\ Is this description above right ?
2\ Is the following Game logic the right way to rendering a game with good efficency?
if not, could I have some indication? thanks!

/* this render() is called every 30 millisecond to render the game.
there may be about 2000 tiles need to be rendered one time. */

/*this texture contains all the tiles needed in the game*/
glBindTexture(GL_TEXTURE_2D, mTexture);

for(...)// the drawing loop to draw all the staff
/* draw the needed tiles from the same texture */