Sign in to follow this  
Sabbas

Toggling texturing on/off depending on the object

Recommended Posts

Im writing an app for a school project where we're making a 3D terrain roamer. Everything is going well except 1 problem I'm having. I'm loading a heightmap from a file, and texturing with another file. Now I would like to add a simple polygon to resemble a simplistic ocean. Also failry simple. Im doing all my drawing in one simple display function. However I don't want to texture the ocean polygon in any way. I merely want it to be one large blue polygon. As I try to draw it after having drawn my terrain, the color of the polygon wont change. I assume I have to disable the texturing somehow. So my question is - how do I draw some objects in a scene textured, and others as simple primitives with a color specified by a glColor3f call?

Share this post


Link to post
Share on other sites
Use glDisable(GL_TEXTURE_2D) to disable texturing and only use vertex color, then use glEnable to turn it back on.

You should already have a glEnable call in there to do texturing in the first place... :)

Share this post


Link to post
Share on other sites
I did.
I found my problem. After disabling it, my textures were completley disabled.
So I thought it was a state variable controlling texturing in general and not for the individual object.
However I just saw that it was because I forgot enabling it again before drawing the terrain.

Anyway, it's working now - thanks for the help.

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