# OGL 2D and origin in Screen upper-left

This topic is 4121 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I know this is a rather basic question, but I needed to ask it to remind myself and maintain my sanity. There is NO way simply using matrices at startup (like Ortho and maybe a scale) to set the origin in OGL to the upper left corner of the screen and have positive Y point down (like in D3D, or image rendering programs), correct? gluOrtho2D(0,width,height,0) causes everything to be clipped, because the right clipping plane is to the left of the left clipping plane, and using like a -Y scale causes the vertices to line up, but everything gets drawn upside down. If you really want to pretend the origin is in the upper left, you have to do a lot of (ScreenH- PointY), correct? I spent a chunk of time trying to figure this out a couple of years ago and gave up. (I had convinced myself it was impossible). Now I just wanted to reassure myself again before I invested a bunch more time in it. Thanks for any help!

##### Share on other sites
I'm sure flipping the params to glOrtho should do what you want - in fact I'm sure I've done just that myself many moons ago and it's worked without a hitch. I'm not sure what you mean by "the right clipping plane is to the left of the left clipping plane", frankly it sounds like nonsense.

##### Share on other sites
umm...
		glOrtho(0, xres, yres, 0, -1.0, 1.0);

##### Share on other sites
Ah, ok, I think I've figured out what the problem was. It's not a clipping plane problem, it's a Face Winding/culling problem. I had forgotten that inverting a single axis will reverse your face winding direction.

I suppose I can fix the whole "my sprites are inverted" problem in my sprite drawing routine, just changing the texture coordinates. My mistake was in thinking that I wouldn't have to change that other stuff.

Thanks for the heads up, guys.

##### Share on other sites
Just disable back face culling....

##### Share on other sites
If you are just using OpenGL to blit and not using the z-coordinate for overlay priorities, you might want to disable z-buffering also.

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5
frob
12

• 9
• 21
• 12
• 9
• 17
• ### Forum Statistics

• Total Topics
632607
• Total Posts
3007387

×