• Advertisement

Archived

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

Texturing

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

Any idea''s why this code draws a series of white boxes on the screen, when other textures draw just fine...? int i, j, x, y; i = j = x = y = 0; glEnable (GL_TEXTURE_2D); top: if (j < h) { for (i = 0; i < w; i++) { //Draw tiles x += (16 * i); glBindTexture (GL_TEXTURE_2D, tile[j].texid); glBegin(GL_QUADS); glTexCoord2f (0,0); glVertex3f(x, y, 0); glTexCoord2f (1,0); glVertex3f(x + 16, y, 0); glTexCoord2f (1,1); glVertex3f(x + 16, y + 16, 0); glTexCoord2f (0,1); glVertex3f(x, y + 16, 0); glEnd(); } //i = 0; // needed? j++; y += 16; goto top; } glDisable (GL_TEXTURE_2D);

Share this post


Link to post
Share on other sites
Advertisement
Well first check to make sure that those textures are actually being generated correctly. (Check the values of tex[j].texid to make sure they look like valid nonzero IDs).

Next you might want to try glFlush() after your glEnd()s. What happens is that everything is not necessarily sent to the video card when you do glEnd() and the buffer may not be getting sent until after you disable texturing again, and state changes happen immediately I believe.

Seeya
Krippy

Share this post


Link to post
Share on other sites

  • Advertisement