Advertisement

Textures, colours, and Lighting

Started by December 29, 2000 12:35 AM
1 comment, last by RedMage 23 years, 10 months ago
Still new to OpenGL so bear with me... In my scene, I have an object that is texture mapped. The texture map consists mostly of various shades of green. My scene also contains some objects that are NOT texture mapped. It seems that when textures are enabled, it doesn''t matter what calls I make to glColor3f(), my non-textured objects will be coloured in some shade of green if texture mapping is enabled. I solved this problem by disabling texture mapping for the duration of drawing my non-texture objects. This works great, except when I try to add lighting to the scene... When I add a light source, my textured objects are properly lit, but my non-textured objects seem to be either totally white or not lit at all... but if texturing is enabled the lighting is perfect but the colour is all wrong! It seems I just can''t win in this situation. What am I doing wrong here? Any advice is much appreciated. Thanks.
Your non-textured object has that shade of green because the 3d card is trying to texture that polygons but it has no texture coordinates for them so you''ll get a color from the current texture (green in this case).

Always disable texturing by doing glBindTexture(GL_TEXTURE_2D, 0) or glDisable(GL_TEXTURE_2D) before you draw non-textured polygons.

About the light:
- do you use vertex normals? (ie. 3 normals per triangle)
- is your ambient light color not too bright?
- have you enabled one or more lights? ( glEnable(GL_LIGHT0+i); )
- have you enabled lighting? ( glEnable(GL_LIGHTING); )
Advertisement
disable texturing and enable material coloring. Refer NeHe''s tute on buifing fonts. No:14 I think.

This topic is closed to new replies.

Advertisement