We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › OpenGL lighting coordinates
Page Index Toggle Pages: 1
OpenGL lighting coordinates (Read 657 times)
OpenGL lighting coordinates
Mar 11th, 2009, 12:53am
 
Hi!

I've been trying to mix some OpenGL calls into my code, and have noticed a weird discrepancy between lighting coordinates and geometry coordinates.  If I draw both a square and a light at (0, 0, 0), the cube will appear in the upper-left corner of the screen, while the light appears in the center of the screen.  I've called noLights() to try and keep Processing's lighting from doing strange things, but it doesn't seem to make a difference.  Changing the camera angle has no effect on the light -- the light still illuminates the center of the screen only, even though the position of the geometry changes to match the camera.  The closest analogy I can think of is having the center of the screen always illuminated.

I call the OpenGL context as follows:

PGraphicsOpenGL pgl = (PGraphicsOpenGL) g;
GL gl=pgl.gl;
// set up lights here
gl.glBegin(GL.GL_TRIANGLES);
.
.
.
gl.glEnd();

Does anyone have any idea why this behavior is occuring?
Re: OpenGL lighting coordinates
Reply #1 - Mar 11th, 2009, 1:29pm
 
use GL gl=((PGraphicsOpenGL)g).beginGL(); to push all the processing matricies into GL, that should unify the coordinate systems.
Page Index Toggle Pages: 1