PDA

View Full Version : lighting does not work on every machine?



Interface
02-07-2004, 03:05 AM
Hi,

i have been trying out some opengl stuff. It works pretty good, only thing is that on some machines the lighting doesn't seem to work correctly. I did not distribute the gl dll files to make sure the machines use their appropriate dlls.

Also, i threw in a lot of polygons to check out framerates on different machines, but i don't really seem to understand the logic in that. I do see that on every machine i've tried this on, the CPU usage is 100%. Will this improve when i throw in textures and use the ARB extension? Or will it even worsen the framerate?

thanks for any advice or comments.

Interface
02-07-2004, 03:24 AM
I'm sorry... with lighting doesn't work i mean that it looks like if i didn't specify any normals... if i change camera the colors change (darker/lighter) but every polygon has the same darkness so to say.

ZbuffeR
02-07-2004, 05:46 AM
For your lighting problem, it should not change across implementations. Well, I don't know. It is most likely to be something in your code. What are the card/drivers that exhibit this problem ?

What do mean with mixing fps and cpu usage ? If you want to see below 100% cpu usage, you can activate vsync.

Interface
02-07-2004, 06:07 AM
I got it to work on all machines now.
I've changed a few things in the code, should try redoing some things to see what exactly caused this.
I changed my light0 coding... i put in all three lighting values (ambience, diffuse, specular) instead of just one.
On the other hand, i glEnabled/glDisabled the light0 at every frame drawing. I think this is the trick, no?
Are there any guidelines in the red/green/blue book (red is it, right? http://www.opengl.org/discussion_boards/ubb/smile.gif) about where to call what and in which order?

about the cpu usage, that was a stupid question, it is of course due to my main loop in the program, forget that i asked http://www.opengl.org/discussion_boards/ubb/tongue.gif

ZbuffeR
02-07-2004, 07:12 AM
Do glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); only once, after GL context creation, and before any glBegin. It should be enough, apart from the case where you have multiple gl contexts, but it is unlikely.

As GL is a state machine, every setting is active until something explicitely change it. But I must admit that sometimes it can be hard to track http://www.opengl.org/discussion_boards/ubb/smile.gif .

nexusone
02-07-2004, 11:38 AM
Also check your math routines, sometimes between compilers there are some diffrences there.

Interface
02-08-2004, 10:35 AM
i think i found it...
glMatrixMode(GL_MODELVIEW) was at the end of my init() function...
apparently, anything texture/lighting related done after that call is being ignored, but not on every gl implementation apparently...
Freaky stuff, but it's indeed something with the stack/state things :-)

Thanks for the help.