Opengl Color And Lighting

I use glColor3fv and glVertex3fv functions to render object. I used fallowing parameters before rendering.
There are some problems with colors and lighting. Object doesn’t seem as a solid object. It seems as if it is transparent.
And colors are sliding.

How can I change these fallowing parameters to make the object solid and correct colors?


What does “seems like transparent” and “colors are sliding” mean? It is is transparent, disable the blending. Also, you are enabling texturing but aren’t using any (as fas I understood)?

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 it be ?

If texturing is enabled, texture and vertex color are mixed together. You can’t just enable the texture on some vertices and disable it on the others. I recommend you separating your object into triangles that need texturing and triangles that don’t, and draw them separately. Or you can edit your texture, so it will emulate vertex colors.

Another (but probably very messy, as it will require vertex duplication) implementation would be this:

  1. use the GL_MODULATE texture envoronment (glTexEnv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE) - this couses the texture and vertex colors to be multiplied
  2. for triangles that should be textured, use white vertex color
  3. for triangles that should be only colored using vertex color use white texture parts

Texture (with .tga mapped) is mixed with color parts. And object seems to be transparent. But vertex coordinates are correct. What can be the problem and solution?

Code is like following :
glEnd ();

glEnd ();

When I use two colors in one object(some parts of object is red, some parts of object is yellow for example), colors are mixed.
Because object seems to be transparent. So colors are mixed. If I make object as a solid, I don’t think it will be a problem with colors.

How can I make the object as a solid?

{ So one side of object will be red, other side will be yellow for example }

When I use fallowing procs, and object is not transparent, then colors are mixed again.
How can I prevent mixed colors?

It is very hard to understand your problems.
If you can not explain in english, please post images (not too big !) showing the problem, and the result you want to get.

Texture image(.tga) has pink flowers on it. Some parts of object are covered with this texture image. Some parts of object have red color. When I rendered this object, texture image color is changed. Pink flowers changed as red. I think colors are mixed.

I want to see texture image correctly.

That’s the problem.

Try the DECAL texture mode : where the texture is, only the texture show up, outside the texture or for alpha parts, it is the object color. You need to have proper rgba texture, with alpha “holes” if you need it.

Can you please post images if you still have problems ?


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.

1-) What can be solution for it ?
2-) How can I send .jpg file? I don’t see any attachment on this forum.

You need to upload your image to a website (you can find plenty, search for “image hosting”, ie try , then :

To avoid color interpolation between vertices, use glShadeModel(GL_FLAT);, each polyon color will be from its last vertex color. Search the man pages for details.