Sign in to follow this  

Mixing textures and flat shading

Recommended Posts

Hi guys, sorry for the dumb question - i must be missing something simple but I just don't know what. I've managed to get a texture mapped quad on the screen. However, if I then try to draw another shape without a texture nothing gets displayed. If I take the texture out everything is fine. I'm working in orthogonal mode as it's a 2D project i'm gearing up for. My init code contains:
	glEnable(GL_TEXTURE_2D);						glShadeModel(GL_SMOOTH);						glClearColor(0.0f, 0.0f, 0.0f, 0.0f);					glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);			glEnable(GL_BLEND);


and my drawing code contains:
	glBindTexture(GL_TEXTURE_2D, textures[0]);
	glTranslatef(320.0f, 240.0f, 0.0f);
	glColor4f(1, 1, 1, 1);
		glTexCoord2f(1, 1);
		glVertex2f( 100, 100);
		glTexCoord2f(1, 0);
		glVertex2f(100, 0.0f);
		glTexCoord2f(0, 0);
		glTexCoord2f(0, 1);
		glVertex2f( 0.0f, 100);

	glBindTexture(GL_TEXTURE_2D, 0);
	glTranslatef(320.0f, 240.0f, 0.0f);
		glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
		glVertex3f(0.0f, 100.0f, 0.0f);
		glColor4f(0.0f, 1.0f, 0.0f, 0.5f);
		glVertex3f(-100.0f,-100.0f, 0.0f);
		glColor4f(0.0f, 0.0f, 1.0f, 0.0f);
		glVertex3f( 100.0f,-100.0f, 0.0f);

Could anyone give me some pointers as to where i'm going wrong please? TIA [Edited by - phantom on November 4, 2005 8:15:25 AM]

Share this post

Link to post
Share on other sites
I don't see anything wrong with it. Instead of binding a NULL texture have you tried to disable 2d texturing and drawing and the enabling the 2d texture after drawing the quad with no texture ?

Does that work for you ?

Share this post

Link to post
Share on other sites
Yes! That fixed it, thank you. I didn't realise that I had to disable texturing in order to draw a solid shape - especially if i've selected no texture and specified the colours of the vertices.

Thanks CRACK.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this