Archived

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

Argh!!

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

I''m trying to write a 2D scroller-type game, and I''m hoping someone here could help me out with a problem that I can''t seem to solve that would help me out immensely. In the code I''m posting below, the program basically loops through an array (called "Map") and returns the value of the current entry in the array. This number is then used to bind a texture to a quad. Now, my problem is this: I can''t seem to figure out how to draw a row of quads. Right now, it just draws one long quad. I''ve attempted to try some different things (such as incrementing each vertex''s X value by 1), but I can''t seem to make it draw 5 (the size of the array) seperate quads in a row. I know the solution is simple, but I have no clue how to do this. ANy help would be appreciated!
  
for (int i = 0; i < 5; i++)
{

tex = Map[i];
        
glBindTexture(GL_TEXTURE_2D, texture[1]);

glBegin(GL_QUADS);
glTexCoord2f(1.0f,0.0f); glVertex3f(pos1+i,0.2f,0.0f);
glTexCoord2f(1.0f,1.0f); glVertex3f(pos2+i,-0.2f,0.0f);
glTexCoord2f(0.0f,1.0f); glVertex3f(pos3+i,-0.2f,0.0f);
glTexCoord2f(0.0f,0.0f); glVertex3f(pos4+i,0.2f,0.0f);
glEnd();

}
  

Share this post


Link to post
Share on other sites