void draw()
{
// clear color and depth buffer
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
// should be white
glColor3f(1.0f,1.0f,1.0f);
// but this polygon gets the texture's color ??
glBegin(GL_LINE_LOOP);
glVertex3i(150,150,0);
glVertex3i(200,150,0);
glVertex3i(200,200,0);
glEnd();
/* Select Our Texture */
glBindTexture( GL_TEXTURE_2D, texture[0] );
glBegin(GL_QUADS);
/* Bottom Left Of The Texture and Quad */
glTexCoord2f( 0.0f, 1.0f );
glVertex3i(50,50,0);
/* Bottom Right Of The Texture and Quad */
glTexCoord2f( 1.0f, 1.0f );
glVertex3i(100,50,0);
/* Top Right Of The Texture and Quad */
glTexCoord2f( 1.0f, 0.0f );
glVertex3i(100,100,0);
/* Top Left Of The Texture and Quad */
glTexCoord2f( 0.0f, 0.0f );
glVertex3i(50,100,0);
glEnd();
// show the drawings (bring backbuffer to front)
SDL_GL_SwapBuffers();
}
Problem mixing GL_LINE_LOOP and Textures
Hi there,
I'm trying to do two things in my drawing method:
First draw a simple polygon using GL_LINE_LOOP
Then draw a texture and map it to an GL_QUADS
I encounter the problem that the polygon becomes the same color as the texture, although I am clearing color and depth buffer before painting. Even a glColor does not help here.
It seems the texture remains selected and that I have to "unselect" the texture every time before drawing the simple polygon, but how?
Here's to source:
Thanks in advance,
Michael
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement