Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orthographic projection should be relative to the viewport. #2675

Merged

Conversation

modality
Copy link
Contributor

@modality modality commented Nov 9, 2013

The orthographic projection matrix had hardcoded left and bottom values of 0, meaning that when a camera was rotated, it would appear as if the entire scene had been rotated around the bottom left corner of the screen, regardless of where the camera was positioned.

IMHO, the view of your scene should be roughly similar when toggling between these two projections. A different projection should not require any fiddly translation by a developer to compensate. It should be handled internally by ofCamera.

Here are some screenshots to demonstrate what I'm talking about.

Positions of primitives in space:
Red cube is at (0, 0, 0)
Green sphere is at (0, 0, -128)
Blue cube is at (128, 0, 0)
Cyan box is at (128, 64, 0)

Front Current
front broken

Front Fixed
front fixed

Left Current
left broken

Left Fixed
left fixed

@SoylentGraham
Copy link
Contributor

+1 for relative client space coordinates (this is how I expected it to be setup the first time I used the ortho projection)

I made a similar change locally where I passed in a 2nd Rect to specify the Ortho Space dimensions (in my case [0,0]..[1,1]) which defaulted to viewPort, IIRC (will check) I had to change 2 lines in v7, but maybe not v8....

Anyway, that worked splendidly for me

@SoylentGraham
Copy link
Contributor

Oh except for font-rendering, which I always had to put some explicit push/scale/pop around

@yty
Copy link

yty commented Apr 17, 2014

+1 Hope to merge..

@ofTheo
Copy link
Member

ofTheo commented Dec 30, 2014

This looks good to merge to me.
@arturoc @openframeworks/2d-3d - any objections?

@arturoc
Copy link
Member

arturoc commented Dec 30, 2014

nope, looks great to me

arturoc added a commit that referenced this pull request Dec 30, 2014
Orthographic projection should be relative to the viewport.
@arturoc arturoc merged commit a4995a6 into openframeworks:master Dec 30, 2014
@kylemcdonald kylemcdonald mentioned this pull request Nov 1, 2015
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants