Re: [PyOpenGL-Users] gluPerspective arguments ?
Brought to you by:
mcfletch
From: Black <py...@bl...> - 2006-07-04 15:12:24
|
It doesn't matter which order gluPerspective() and gluLookAt() are called in... However, what _does_ matter is that gluLookAt() is supposed to be the "view" part of the modelview matrix so you want your OnDraw to look more like glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective( some more reasonable arguments ) glMatrixMode(GL_MODELVIEW) glLoadIdentity() gluLookAt(x , y, z, 0, 0, 0, 0, 0, 1) glEnable(GL_DEPTH_TEST) glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) # Draw cube glBegin(GL_QUADS) .... glEnd() self.SwapBuffers() As a side note, you probably want the last three arguments to gluLookAt() to be 0,1,0 so you aren't lying on your side... This is probably enough to give you something to look at, but I do urge you to spend some more time figuring out what the projection and modelview matrices are and what they do before you get too much farther. You might also want to look at some more examples of how to organize your code - a lot of the stiff you put in your draw() function really shouldn't be there. On Jul 4, 2006, at 12:26 AM, Anders Wallin wrote: > Greg Ewing wrote: >> >>> i.e. could it be that the python wrapper has the near/far arguments >>> reversed ? >> I'm using it with near < far without any problems. >> Maybe there's something weird about the coordinate >> system you're using? > > My OnDraw() looks something like this: > glMatrixMode(GL_PROJECTION) > glLoadIdentity() > gluPerspective(20, 1, 20.0, 1.0) # why 20 > 1 ? > gluLookAt(x , y, z, 0, 0, 0, 0, 0, 1) > > glMatrixMode(GL_MODELVIEW) > glEnable(GL_DEPTH_TEST) > glEnable(GL_LIGHTING) > glEnable(GL_LIGHT0) > # Draw cube > glLoadIdentity() > glBegin(GL_QUADS) > .... > glEnd() > self.SwapBuffers() > > > > If anyone has any good ideas on why my gluPerspective works funnily > then > let me know! > for example, does it make a difference in which order Perspective and > LookAt are called ? > > -- > Anders Wallin > > > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users |