Jump to content
  • Advertisement
Sign in to follow this  
senem

OpenGL Opengl Color And Lighting

This topic is 3890 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Texture coordinates and vertex coordinate are OK.
The problem is about colors and texture seems to be mixed.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!