Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texturing

Started by shalrath Jul 13, 2001 at 8:31 AM 0 replies 650+ views
Original Post
shalrath
shalrath
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);
Krippy2k
Krippy2k
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.