Sign in to follow this  
stevenie

OpenGL about glPerspective

Recommended Posts

hello everyone, I'm practising with opengl perspective view.

Please look at my code:
http://snipt.net/stevenie/opengl-1?key=4d86d2326ba0331bbcc5bef606dbd482

So far, I can't see anything on the screen. However, if i change the translation from 17 to -17, i can see the sphere. The thing I don't understand is the -17 is not in the interval between [0.1 to 1000], how come it would work? I also notice that its says the z is always positive, how does this work it i want to look at the negative z axis? Thanks!

Steven

Share this post


Link to post
Share on other sites
The perspective doesn't define the direction that you are looking, only the depth from the camera that fits between the clip planes.

The 0.1 to 1000 just means "draw everything between 0.1 and 1000 units in the direction that my view is facing". It doesn't define whether this is down the positive or negative z axis, or x axis, or whatever axis you happen to be looking down.

By default the view is pointing down the negative z axis, so you see in the perspective view items between -0.1 and -1000z.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this