glortho, zooming

Started by
4 comments, last by one mind 19 years, 6 months ago
Hi, I have made a simple modeller with 4 vieports and i am trying to figure out how to zoom my cameras. For the perspective view, i just increase or decrease the glulookat eye and origin. I am having a problem with the orthos views. This is what i am doing so far Gl.glOrtho(-100/zoom2, 100/zoom2, -100*half_height/half_width/zoom2, 100*half_height/half_width/zoom2,-100/zoom2,100/zoom2); zoom2 is equal to 1 at the start and changes by 0.001 when the mouse moves up and down. This is working well except, when i zoom in too far everything disappears and when i zoom out to the point everything is tiny, i keep on zooming but everything gets bigger but in reverse. Any help would be great Thanks :)
Advertisement
You probably don't need to divide the Z coordinates by zoom2. All this does is restrict the range of visible depths.

Also, beware of what happens when zoom2 goes below 0.
Thanks uavfun

I still cant figure it out

I was wondering if there was a usual way to zoom in glortho

This is what I use for zoom:

void SetFov(float aFov){	GFXAPI().ResizeScene(GAME.Options().mScreenRes.width, GAME.Options().mScreenRes.height, aFov);}void TGfxApi::ResizeScene(int aWidth, int aHeight, float aFov){	ASSERT(Invariant());	ASSERT(aHeight>0 && aWidth>0);	glViewport(0, 0, aWidth, aHeight);	glMatrixMode(GL_PROJECTION);	glLoadIdentity();	// Calculate the aspect ratio of the window:	gluPerspective(aFov, aWidth/(float)aHeight, 1, GAME.Options().mViewDistance);	glMatrixMode(GL_MODELVIEW);	glLoadIdentity();	ASSERT(Invariant());}


Where fov of 90 = normal, fov of <90 = zoom in.
any way the replace gluPerspective by non glu functions?
Its not so much a real zoom i'm looking for, but a way to make the seen bigger and smaller. Perspectvie was easy because u just move the eye forwards and backwards and everything gets biggers or smaller on its own.
I'm looking for the same effect with orth. Moving the eye doesn't effect anything size so i have to scale the whole ortho volume.
Just looking for a good way to do that :)

Thanks for the code

This topic is closed to new replies.

Advertisement