Skip to main content
GameDev.net gamedev.net
🔒 Locked

OpenGL Light problem

Started by Prozak Jan 8, 2002 at 1:18 PM 5 replies 600+ views
Original Post
Prozak
Prozak
Well, i set up a light in opengl, and i have a textured cube in the scene, and the cube rotates and stuff, but the weird thing in all of this is that the cube gets darker or brighter according to how much it is rotated. There is something weird with this, the object gets brighter when it is rotated to a certain degree... Well, i just thought some of you had seen, or experienced a similar behaviour, and how did you fix it? This is obvious an "ignorance" bug, where the programmer still does not know enough about the API, and stumbles upon behaviours that he sees as weird, althought they can easily be explained... Thanx for any help on this,

[Hugo Ferreira][Positronic Dreams][]
"Research is what I''m doing when I don''t know what I''m doing."
- Wernher Von Braun (1912-1977)

subnet_rx
subnet_rx
if it doesn''t look realistic, you probably left your glNormal calculations out of your cube definition.

subnet_rx


"There are two types of langages, those that everyone complains about, and those that no one uses."

Standardized C++ Libraries

C++ Programming help

The only news site on the web

Prozak
Prozak
ok, i think i expressed myself really bad...
i know normals and all of that, what happening here,
is that the object becomes more iluminated once it is
set into a certain degree.

Its like you''re standing next to a light bulb, but you''re
only iluminated when you''re seated, which makes zero sense...

I can only see the object when it is rotated to a certain
degree, only then does he become suficiently iluminated
to be visible...

all of this is really weird...

any help?

[Hugo Ferreira][Positronic Dreams][]
"Research is what I''m doing when I don''t know what I''m doing."
- Wernher Von Braun (1912-1977)

HenryApe
HenryApe
Could it have to do with the cube being assigned a mainly specular material? Try giving the cube a diffuse material where you zero out the specular component and see what happens.

Henry
Poya
Poya
I used to have the same problem. I would walk through a map and looking up or down changed the lighting. I think it has something to do with how light positions are transformed by OpenGL. If I remember correctly, everytime you change the projection or modelview matrix, you have to call glLight for your lights again, or something similar to that. You might want to check Red and Blue books on lighting.

Hope that helps

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.