Closed elliottslaughter closed 15 years ago
Near/far don't determine the z-direction, I think. Here's a version that works like you want: http://gist.github.com/207128
No, I'm pretty sure glOrtho specifies the z-coordinates. The docs say this:
nearVal, farVal: Specify the distances to the nearer and farther depth clipping planes. These values are negative if the plane is to be behind the viewer.
http://www.opengl.org/sdk/docs/man/xhtml/glOrtho.xml
The following post (especially the first reply) helps describe what is going on. Sounds like the values are along the negative z-axis, which jibes with what I've seen.
http://www.gamedev.net/community/forums/topic.asp?topic_id=538300
Finally, the following seem to be equivalent:
;; your solution
(ortho-view 0 0 640 480 -1 1)
(scale 1 1 -1)
;; my solution
(ortho-view 0 0 640 480 1 -1)
Okay, sorry I over-simplified the issue. But just to be clear, would this behave per your expectations if I inverted the near and far values when defining the orthographic view?
No, I just didn't have a proper understanding of glOrtho.
I do think it is a little confusing that ortho-view doesn't keep parameters in the same order as glOrtho -- I had to read the source code to figure out the parameter order.
That's a fair point. I always forget the order of the glOrtho parameters, and I thought mine was easier to remember. That's probably only true for me, though.
I agree with you up to a point -- maybe your ordering is easier to remember than glOrtho's. But anyone with experience in OpenGL, and anyone who reads the OpenGL API while trying to use penumbra (because there is far more OpenGL documentation than penumbra documentation), will probably expect to find the same parameter order in penumbra.
Yeah, I agree. I'll open an issue to change that to the standard ordering.
Hi,
Depth and ortho-view don't seem to be behaving the way I expect them to. Please take a look at my gist below and tell me if that is the expected behavior or not.
http://gist.github.com/207044
Basically, I am calling ortho-view with near as -1 and far as 1. But when I draw something at negative depth, it shows up below, and for positive depth, it gets drawn above other objects. I have to reverse near and far to get the ordering I want.
In the above gist, three rectangles are drawn. The red one is at depth 0, the green is at -0.5, and blue is at 0.5. But the green rect is at the bottom, and the blue is on top.
Do you know what is going on? Thanks.