From: Combe, C. <C....@na...> - 2002-07-09 15:16:27
|
thanks, col -----Original Message----- From: Antony Ribot [mailto:an...@li...] Sent: 09 July 2002 16:18 To: Combe, Colin; gl4...@li... Subject: Re: [gl4java-usergroup] lighting problem http://www.acm.org/pubs/tog/GraphicsGems/gemsiii/newell.c Antony ----- Original Message ----- From: "Combe, Colin" <C....@na...> To: <gl4...@li...> Sent: Tuesday, July 09, 2002 3:59 PM Subject: RE: [gl4java-usergroup] lighting problem Thanks Jens and Antony, yes, as you have both pointed out i have a problem with my normal calculations - a simple cube works fine. Oh dear... i'm not sure how to start debugging... cheers, col -----Original Message----- From: Jens G=FCnther [mailto:jen...@ag...] Sent: 09 July 2002 15:30 To: Combe, Colin Subject: Re: [gl4java-usergroup] lighting problem Hi Colin, i use the following structure in my display()-method: glMatrixMode( GL_PROJECTION ); // define properties for = projection glLoadIdentity(); // initialize projection matrix glFrustum(); // define view frustum, you can // also use gluPerspective(...) glMatrixMode( GL_MODELVIEW ); // start of model transformations glLoadIdentity(); // init modelview-matrix // place here objects, which are static to the cameraposition. This // means that all objects you draw here move with the camera, like a // headlight. glLoadIdentity(); // again init modelview-matrix to // forgot the transformations = make // to the camera-static objects // now place here your transformation for the camera. gluLookAt(...); // and now after a long way of initializing... draw your objects, also // lights like the following ( in my code ): glLightfv( GL_LIGHT0, GL_POSITION, vpos ); // static Light glPushMatrix; // save current transformation, // the cameraview //transform object //draw object glPopMatrix; // forgot last transformations hope, this would help you. The logic for translations, rotations and scale is'nt easy to understand, i had tried many times to get the right orders. Finally i compiled your code and run it. If you exactly observe your model you must recognize that it seems as the light will rotate faster as the model, so I THINK YOU HAVE SOME PROBLEMS WITH YOUR NORMALS! Because if you comment out the push and pop between the lightposition = is made then you will have a structure nearly to my. good luck ;) Jens ----------------------------------------------------- [ age-works softwaretechnologies ] http://www.age-works.de Jens G=FCnther email: jen...@ag... ----------------------------------------------------- ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Stuff, things, and much much more. http://thinkgeek.com/sf _______________________________________________ gl4java-usergroup mailing list gl4...@li... https://lists.sourceforge.net/lists/listinfo/gl4java-usergroup |