Jump to content
  • Advertisement


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



This topic is 5749 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]);

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);


Share this post

Link to post
Share on other sites
i dont quite understand what output u got, and what u want,
but what i can see from the code is,
bind should be
glBindTexture(GL_TEXTURE_2D, tex);

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
or maybe
glBindTexture(GL_TEXTURE_2D, texture[tex]);

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!