
Hi everybody. I have problems to get a fixed light source. The light seems to rotate together with my model. Are there anywhere a few examples (these under GLUT/examples/.... are not so helpful) where I can have a look on other peoples work? Greetings Patrick

The tutorial under http://www.tfh-berlin.de/~panitz/hopengl/ seems to be enough stuff :-) My fault. Greetings Patrick Am Donnerstag, 9. Oktober 2003 15:13 schrieb Patrick Scheibe:
Hi everybody. I have problems to get a fixed light source. The light seems to rotate together with my model. Are there anywhere a few examples (these under GLUT/examples/.... are not so helpful) where I can have a look on other peoples work?
Greetings Patrick _______________________________________________ HOpenGL mailing list HOpenGL@haskell.org http://www.haskell.org/mailman/listinfo/hopengl

The hopengl tutorial I started to write (http://www.tfh-
berlin.de/~panitz/hopengl/index.html)
unfortunatly currently ends, when it comes to light sources.
However some basic information and examples can allready be
found there.
gruss
Sven Eric
On Thu, 9 Oct 2003 15:13:13 +0200, Patrick Scheibe
Hi everybody. I have problems to get a fixed light source. The light seems to rotate together with my model. Are there anywhere a few examples (these under GLUT/examples/.... are not so helpful) where I can have a look on other peoples work?
Greetings Patrick _______________________________________________ HOpenGL mailing list HOpenGL@haskell.org http://www.haskell.org/mailman/listinfo/hopengl
--

The tutorial is fine but doesnt help me. Following (too simple) problem: I want to look at a rotating cube. What happens is, that I'm rotating around the cube. That means the cube looks sometimes dark and sometimes bright like the day and nightside of a planet. I've read the lighting part of the OpenGl-Redbook. They write that you have to put the "light position"-function different places to get different results. This seems totally intuitve and clear to me. E.g. to put it after a translation in the displayfunc produces a translation of the light source... But in my code the "position (Light 0) $= ..." call doesnt do anything. It doesnt matter where I put it in the code and it makes no difference what position in my room the lightsource gets. Everytime the animation looks equal to that before. I think I've forgotten something really important or some calls are not on the right place. Here is my code. The lightposition-call isnt in there but I tried every possible position in the code. The light-stuff is stolen from one of the GLUT examples. This example looks fine but doesnt have any animation. <haskell> myinit = do lighting $= Enabled light (Light 0) $= Enabled main = do ... initialDisplayMode $= [GLUT.Double, GLUT.RGBA, GLUT.Depth] ... myinit ... myReshape :: ReshapeCallback myReshape size@(Size w h) = do viewport $= (Position 0 0, size) matrixMode $= Projection loadIdentity perspective 60 ((fromIntegral w)/(fromIntegral h)) 0.01 100.0 lookAt (Vertex3 0 0 5) (Vertex3 0 0 0) (Vector3 0 1 0) matrixMode $= Modelview 0 loadIdentity myDisplay :: IORef GLfloat ->DisplayCallback myDisplay arg = do angle <- readIORef arg clear [ColorBuffer, DepthBuffer] matrixExcursion $ do rotatef angle (Vector3 1 1 (1::GLfloat)) stdCube swapBuffers </haskell> I dont know if this mailinglist supports atachments but here to pics of this cube at day and night :-) Greetings Patrick

FYI: The problem has been solved: When one uses lighting, one has to specify normals, too. Otherwise the same normal (default: Vector3 0 0 1) is used for all vertices/surfaces, yielding strange looking results. Two hints: GLUT's renderObject can render some useful basic geometric objects with correct normals, and GLUT's addTimerCallback is quite handy for simple animation. Cheers, S.

Patrick Scheibe wrote:
I have problems to get a fixed light source. The light seems to rotate together with my model.
Apart from a totally black screen because of a sign error, this seems to be the most popular bug *everybody* does. Welcome to the club! :-)
Are there anywhere a few examples (these under GLUT/examples/.... are not so helpful)
I haven't finished porting all the examples from the Red Book to the new API, so this situation should improve in the future.
where I can have a look on other peoples work?
The first place to look is: http://www.opengl.org/developers/code/tutorials.html The one I really like from this list is: http://nehe.gamedev.net/ And the following has a good example for lighting, IIRC: http://www.xmission.com/~nate/tutors.html Cheers, S.

Thanx. I'm not all the time online and read your answer too late. Ignore my "problem-description".. I check your links Cheers Patrick Am Donnerstag, 9. Oktober 2003 17:10 schrieb Sven Panne:
Patrick Scheibe wrote:
I have problems to get a fixed light source. The light seems to rotate together with my model.
Apart from a totally black screen because of a sign error, this seems to be the most popular bug *everybody* does. Welcome to the club! :-)
Are there anywhere a few examples (these under GLUT/examples/.... are not so helpful)
I haven't finished porting all the examples from the Red Book to the new API, so this situation should improve in the future.
where I can have a look on other peoples work?
The first place to look is:
http://www.opengl.org/developers/code/tutorials.html
The one I really like from this list is:
And the following has a good example for lighting, IIRC:
http://www.xmission.com/~nate/tutors.html
Cheers, S.
_______________________________________________ HOpenGL mailing list HOpenGL@haskell.org http://www.haskell.org/mailman/listinfo/hopengl
participants (3)
-
Patrick Scheibe
-
Sven Eric Panitz
-
Sven Panne