Textured and untextured quads
Posted: Sat Oct 01, 2011 5:52 am
Hi folks,
I'm having problems using textures in OpenGL. Basically what happens is I'm trying to draw one textured quad, and the whole rest should not be textured but just colored. According to Ginto's explanation last evening, I use this code (actually not quite, I filled in the variables for better reading), after entering GL_QUADS, for the textured and the following, had-better-not-be-textured quad:
But it won't work. Instead, what I get is one textured quad with stars, and the rest are BLACK quads. The last glTexCoord2f I'm calling up there refers to such a black pixel. When I'm replacing the texture by a white image, the rest is drawn correctly, when using a grey one I'm getting the rest somewhat dark, so the texture has influence on the scene. But shouldn't glBindTexture( GL_TEXTURE_2D, 0 ) prevent OpenGL from applying textures to the other objects?
I'm having problems using textures in OpenGL. Basically what happens is I'm trying to draw one textured quad, and the whole rest should not be textured but just colored. According to Ginto's explanation last evening, I use this code (actually not quite, I filled in the variables for better reading), after entering GL_QUADS, for the textured and the following, had-better-not-be-textured quad:
Code: Select all
// Textured quad
glBindTexture( GL_TEXTURE_2D, texture );
glTexCoord2f( 0.0f, 1.0f );
glVertex3f( -1.0f, -1.0f, -1.1f );
glTexCoord2f( 0.0f, 0.0f );
glVertex3f( -1.0f, 1.0f, -1.1f );
glTexCoord2f( 1.0f, 0.0f );
glVertex3f( 1.0f, 1.0f, -1.1f );
glTexCoord2f( 1.0f, 1.0f );
glVertex3f( 1.0f, -1.0f, -1.1f );
glBindTexture( GL_TEXTURE_2D, 0 );
// Untextured one
glColor4ub( 200, 200, 200, 255 );
glVertex3f( 1.0f, -1.0f, -1.1f );
glVertex3f( 1.0f, 1.0f, -1.1f );
glVertex3f( 1.0f, 1.0f, -1.0f );
glVertex3f( 1.0f, -1.0f, -1.0f );