Sign in to follow this  
senem

OpenGL Opengl Color And Lighting

Recommended Posts

I use texture for some vertexes and colors for some vertexes at the same object. I use them partially at the same object. But, there are some problems texture mapping and colors when I use them together at the same object. Colors seems to be foggy and object seems to be transparent. Texture mapping side is mixed with colors. I want to make them clear (some parts in colors, some parts in texture mapping). How can I make the object clear(partially colored & partially textured ) ? What's wrong with it? Code is like following : .... glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); glDepthMask(TRUE); .... glPushMatrix(); glPushMatrix(); glDisable(GL_TEXTURE_2D); glDisable(GL_LIGHTING); glBegin (GL_TRIANGLES); glColor3fv; glVertex3fv; glEnd (); glPopMatrix(); glPushMatrix(); glEnable(GL_TEXTURE_2D); glEnable(GL_LIGHTING); glBegin (GL_TRIANGLES); glTexCoord2f; glVertex3fv; glEnd (); glPopMatrix(); glPopMatrix;

Share this post


Link to post
Share on other sites
Try glTexEnv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL)

The whole object needs texture coords but you use the texture's alpha channel to define the areas where the texture should be visible.

Share this post


Link to post
Share on other sites
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);

This proc call solved the problem for texture image.
So texture image doesn't mix with color.

Some parts of object are covered with texture image(.tga). Some parts of object are red color, some parts of object are yellow.
The problem is solved on texture image.

But there is still same problem for color. Red color and yellow color are mixed in same object.

What can be solution for it ?

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