From: Combe, C. <C....@na...> - 2002-07-09 15:00:13
|
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=20 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=20 model you must recognize that it seems as the light will rotate faster=20 as the model, so I THINK YOU HAVE SOME PROBLEMS WITH YOUR NORMALS!=20 Because if you comment out the push and pop between the lightposition = is=20 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... ----------------------------------------------------- |