Using orthographic cameras

Problems building or running the engine, queries about how to use features etc.
Post Reply
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Using orthographic cameras

Post by d000hg »

Is there an example/wiki entry on how to use orthographic projection... how to control scaling/zooming when you don't have a view angle and moving the camera forwards doesn't make things get bigger? Are there special methods to control how the world is projected onto the viewport in orthographic mode?

Thanks.
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: Using orthographic cameras

Post by xadhoom »

d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Using orthographic cameras

Post by d000hg »

I found that thread but it didn't seem helpful, a one-line answer. Also, how can you set a field of view on an orthagraphic camera which by definition has no view angle?

I'm sure a 2-line code example would be all I need, my forum search found the link you suggested and another thread which linked to it - neither helped me.
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: Using orthographic cameras

Post by xadhoom »

Ok I see, sorry!

I digged through the code and it seems that the values you provide with these methods in Ogre::Frustum should do the trick:

Code: Select all

   /** Sets the orthographic window settings, for use with orthographic rendering only. 
		@note Calling this method will recalculate the aspect ratio, use 
			setOrthoWindowHeight or setOrthoWindowWidth alone if you wish to 
			preserve the aspect ratio but just fit one or other dimension to a 
			particular size.
		@param w, h The dimensions of the view window in world units
		*/
		virtual void setOrthoWindow(Real w, Real h);

		/** Sets the orthographic window height, for use with orthographic rendering only. 
		@note The width of the window will be calculated from the aspect ratio. 
		@param h The height of the view window in world units
		*/
		virtual void setOrthoWindowHeight(Real h);

		/** Sets the orthographic window width, for use with orthographic rendering only. 
		@note The height of the window will be calculated from the aspect ratio. 
		@param w The width of the view window in world units
		*/
		virtual void setOrthoWindowWidth(Real w);
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Using orthographic cameras

Post by d000hg »

That looks perfect, thanks very much!
Post Reply