PDA

View Full Version : Translation towards the camera.



Flotonic
05-17-2013, 03:15 PM
I probably already have a solution to the math behind moving the scene towards the camera, but it stops rendering when translated much at all and never seems to get closer to the camera even when it is translating. When I was going with making the area larger in scale to make it look like one is zooming in, the clipping wasn't as much of a problem and the range was much greater, so I am extremely confused. I have tried changing glOrtho(0,640,0,WHEIGHT,-1000,1000); to glOrtho(0,640,0,WHEIGHT,-32768,32768); and other things, but the problem remains. How should I go about editing the limits so that I can translate it closer to the camera without it disappearing? Thanks!

uwi2k2
05-18-2013, 01:25 AM
hi,

the Orthographic Projection may be the probem.
Because of its nature you will never get a object as close to the camera as with a Perspective projection.
You should just try it with a perspective and and almost same parameters.

cu
uwi

Flotonic
05-18-2013, 10:02 AM
Thank you for your response! I was using glFrustum(-320,320,-(WHEIGHT/2),WHEIGHT/2,-1000,1000);, but nothing was rendering. Using the glGetError() function resulted in an "Invalid Value" error which wasn't there until I started using glFrustum. After some Googling, I found that negative values cannot be used for the Z Values (even though I think I may need to use them).

I changed the arguments and here is how it renders now:
1030

uwi2k2
05-19-2013, 01:40 AM
hi,

its hard to give you more hints without seeing the code.
if you send me a priv-msg with the code i will change it for you so you see the difference.

cu
uwi

Flotonic
05-19-2013, 01:13 PM
Thanks! I will send you the pieces of code that matter the most.