Original Post
Hello,
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. */
render()
{
glEnable2D;
/*this texture contains all the tiles needed in the game*/
glBindTexture(GL_TEXTURE_2D, mTexture);
glClear();
for(...)// the drawing loop to draw all the staff
{
/* draw the needed tiles from the same texture */
glBegin();
//drawing...
glEnd();
}
SwapBuffers();
glDisable2D;
}
Thanks!
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. */
render()
{
glEnable2D;
/*this texture contains all the tiles needed in the game*/
glBindTexture(GL_TEXTURE_2D, mTexture);
glClear();
for(...)// the drawing loop to draw all the staff
{
/* draw the needed tiles from the same texture */
glBegin();
//drawing...
glEnd();
}
SwapBuffers();
glDisable2D;
}
Thanks!