View Full Version : shading textures
04-18-2001, 08:21 PM
I know that this has been covered before but in my searches I haven't found anything. I am trying to use built in OpenGL shading, but it won't shade the textures. I am using display lists and I think the solution is somewhere in glTexEnvf() but when I use blend it screws up all the colors in the screen.
Any help would be greatly appreciated http://www.opengl.org/discussion_boards/ubb/smile.gif
04-19-2001, 01:58 PM
Only a oracle could give you an answer. http://www.opengl.org/discussion_boards/ubb/smile.gif
Maybe someone can help you if you describe what you are doing.
04-19-2001, 06:53 PM
I am working on a 3d video game. We have written our own engine and everything. We read in the objects in the scene from scenefiles and place them onto a map. Now each object can contain colors as well as texture mapped polygons. For example one of our scenefiles is a jeep. The jeep is green but on the hood we have a star texturemapped onto it.
The goal of this project is to use OpenGL to get a good looking game. Now I have set up a lightsource. and I have calculated all of the normals for every polygon in the whole scene. When I try to shade the colored areas are shaded, but the polygons that are texturemapped are not. From this I know the problem is not in the lightning or any of that.
Now the question remains is there a way to shade a textured polygon. Currently I am using modulate for the parameter to glTexEnv(). Do I need to use something else. Do I need to put up some of my code so that you can see it?
04-20-2001, 12:31 PM
Ok, I have narrowed down my problem. I have found out that NeHe has a tutorial on getting shaded textures. Now the question that I have is there a tutorial out there that does both shaded textures and shaded colored polygons at the same time. So far, I can only get one or the other. When I enable GL_COLOR_MATERIAL it screws up texture shading, but when I take it out my colored polygons become white. Granted they are shaded but those polygons are not their correct colors.
04-20-2001, 01:55 PM
I get the impression that you are using the same settings for all your objects and that will probably not work. You could use replace instead of modulate for your textured polygons if you wish. But you can also use modulation, from the red book:
"Modulation is a good texture function for use with lighting, since the lit polygon color can be used to attenuate the
texture color. Most of the texture-mapping examples in the color plates use modulation for this reason. White, specular
polygons are often used to render lit, textured objects, and the texture image provides the diffuse color."
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.