first of all, thanks for your help.
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
> Python Specification
> glOrtho (left, right, bottom, top, zNear, zFar) -> None
> 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.
i forgot to say i am doing a 2D orthogonal system and that i need to
work with pixels, this is why i match the opengl units to width and
height of the window in pixels. I set the projection to those values
because i want it to be like that.
I already tried to see if changing the values passed to the glOrtho
would make any difference but they dont. Thats pretty weird.
> > 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.
interesting, so you suggest there mus be something that linux doesnt
like about my projection but i am not getting the exception, that could
be a possibility and explains why passing different values to glOrtho
does not make any difference.
But the problem should be caused by something else than the glOrtho
setyo, otherwise my simple example (find it attached) would not work either.
I tested today the same code in another linux machine and i get the same
result. I guess I will have to do some step by step testing to find out
what is causing this.
> To sum up:
> 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
> PyOpenGL Homepage
> PyOpenGL-Users mailing list