Re: [PyOpenGL-Users] bug on glcanvas?
Brought to you by:
mcfletch
From: altern <al...@gm...> - 2006-11-22 09:25:17
|
hi again i also forgot to say that exactly the same code using pygame instead of wxpython works fine in both windows, linux and OSX enrike George Paci wrote: > altern wrote: > > > This is the detailed description of error: > > I use glOrtho(0, 800, 600, 0, 5000, 0) > > to set up the projection, > > From the docs at > http://pyopengl.sourceforge.net/documentation/manual/glOrtho.3G.xml > : > > Python Specification > > glOrtho (left, right, bottom, top, zNear, zFar) -> None > > Parameters > > left, right -- Specify the coordinates for the left and right > vertical clipping planes. > bottom, top -- Specify the coordinates for the bottom and top > horizontal clipping planes. > zNear, zFar -- Specify the distances to the nearer and farther > depth clipping planes. These values are negative > if the plane is to be behind the viewer. > > > So you're calling it with bottom=600 and top=0, which is the reverse > of the way OpenGL handles y coordinates: greater Y in OpenGL is UP. > > The depth values also seem to be backwards: the docs say they're the > *distances* to the nearer and farther clipping planes. So you probably > want zNear=0 and zFar=5000 . > > Try this and see if it works: > > glOrtho(0, 800, 0, 600, 0, 5000) > > > Except this looks like you're trying to do things in pixels, > not OpenGL's units. A much more natural way would be: > > glOrtho(-400, 400, -300, 300, 0, 5000) > > ... and then (0,0,0) would be at the center of the viewport. > > > This is true in windows but under Linux I get the (0,0) on the > > center of the screen and if I increase the y value of a vertex > > it moves up instead of down. On top of this the values of the > > opengl are not mapped to pixels and moving a vertex by 1 unit > > (should move 1 pixel) moves it out of the window. > > It sounds like your glOrtho() call flat-out failed on Linux > (more precisely, using whatever driver is associated with > your rendering context). Are you sure you're not eating an > exception thrown by the call? My guess is it doesn't like > your depth coordinates. > > To sum up: > > Try: > glOrtho(0, 800, 0, 600, 0, 5000) > > Then, if you really want y=0 at the top, try: > glOrtho(0, 800, 600, 0, 0, 5000) > > In case you're losing polygons in the front part of > the scene, try a negative near depth: > glOrtho(0, 800, 0, 600, -100, 5000) > > Finally, consider putting everything near the origin > (i.e. (0,0,0)) and projecting that in the center: > glOrtho(-400, 400, -300, 300, -100, 5000) > > > --George Paci > > The desire to remain the same is the single most powerful motivator > for change. In order to preserve something, people will change > anything that's less important. -- Dale Emery > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users > |