#### Archived

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

# Argh!!

This topic is 5749 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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);
glEnd();

}


##### 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 on other sites
or maybe
glBindTexture(GL_TEXTURE_2D, texture[tex]);

##### Share on other sites
Yeah, it should have been tex, but that wasn''t the problem. Anyways, I fixed the problem.

1. 1
Rutin
24
2. 2
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 19
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631762
• Total Posts
3002180
×