lighting

Started by
5 comments, last by tsuraan 23 years, 2 months ago
I am working on getting lighting to work with one of my programs, and failing. To try to see what was going wrong, I grabbed the lighting demo from nehe's site and started modifying. I compiled it, and the lighting worked as expected. Then, I cut out the texture loading and texture coordinates, and replaced them with glColor3f(1.0f,1.0f,1.0f) just before the glBegin() for making the cube, right where the texture bind function was. I would expect some kind of white cube being lit in some cool fashion, but instead it is very dark green. Can anyone explain this? Update: I guess nobody cares, but I also have found that the supposedly white cube is a different color depending on whether the program is run fullscreen or in a window. It's rather tan windowed, but when it's running in fullscreen mode it is very dark green. Can someone please explain what is going on? Edited by - tsuraan on February 14, 2001 6:56:59 PM
Advertisement
Questions about lighting is very difficult since you have so many variables to set. It sounds like one of the variables is set to a pretty random value.

It is pretty much to expect that someone should try to guess what lighting demo you mean and load that in a editor and try to do the same changes.
The demo is nehe's lesson 7, lighting, texture binding, and other stuff. Starting from line 159, I simply commented out the glBindTexture and all subsequent glTexCoord2f's. Under where I commented out the texture binding, I added glColor3f(1.0,1.0,1.0). I would expect that this would give me a generally white cube rotating under white light (the light wasn't changed from the demo at all).

Having commented out any reference to a texture, I am now getting a white cube in windowed mode, but a nice, aqua blue in fullscreen. this is very odd. Maybe it's just 'cause my graphics card and drivers suck. Still, some explanation from a knowledgable source would be cool.

Any ideas?

Edited by - tsuraan on February 17, 2001 7:56:14 PM
okay, after considerable playing around, I finally changed the color depth from 16 to 24, and everything is happy now. I''d still love some kind of explanation of this, if anyone has any ideas.

system:
ATI M1 mobility
Windows 2000
I''ve had a similar problem, when I colored my objects and switched on lighting, the where grey, and not colored as I expected.
I played a little bit around and searched the help, and eventually I get it work using
glEnable(GL_COLOR_MATERIAL); // in GLSetupRC()
I don''t really know what it does, but in my prog it worked. I can''t explain why it worked for you without this function in 24 bit mode. (I use 24 bit mode too (if this is what is set in the PIXELFORMATDESCRIPTOR handed to ChoosePixelFormat())).
Try to enable GL_COLOR_MATERIAL in 16 bit mode and tell me your result, I''m curios about it.

System: Windows98 Vodoo3 2000

Greetings Ben
I haven''t looked at the code from the tutorial, but there''s a good chance you still have texturing turned on. Try doing a glDisable(GL_TEXTURE_2D) and see if that solves it.
neither of these had any effect. The 16-bit color still shows white as a aqua-blue, trying either of these settings or both. 32-bit color works great without these, or with them. Strangs...

This topic is closed to new replies.

Advertisement