hey!
I am new to mac as well as opengl(though I have some experience with VC++).
I am building on some basic foundation code I downloaded, but I could specify co-ordinate values only between -1.0 to 1.0 in all the the three axes.
How do I change these values so that I can set the scale for the axes? where do I do that?
What is depth test? Whenever I enable that my display gets weird. Can anyone explain this, please?
I have to rebuild a VC++ application that uses OpenGL extensively. Is there a difference in the OpenGL coding for mac and Windows(apart from the setup of course)?
The changes needed depend on if you are using GLUT or not. If you use GLUT then you shouldn’t need to change much for the windowing, but if you used the Win32 APIs to make windows in VC++ then you’ll have to change the window code for it.
As for the depth test, it’s used to determine if there are fragments that are totally covered by other fragments and will not even process them if they are. This saves some time.
The scalling bit. You’ll need to set up a projection using either glFrustum or glOrtho with the correct arguments in order to set the viewing volume. I believe that it defaults to -1 to 1 on all axis.
If you really don’t know much about Macintosh programming then I suggest that you pick up a book ( Macintosh Programming for Dummies is a great beginning book ) and read through it to get a basic grasp of what’s going on. Then you can look through the AGL ( Apple Graphics Library ) specification to see how to set up an aglContext to use with OpenGL.
fovy is the field of vision angle in the y direction ( in degrees ), aspect is the ratio of the width and height of the screen ( use screenwidth/screenheight ), zNear is the near clipping plane and zFar is the far clipping plane.
To make sure that you wont miss anything try setting up gluPerspective as such:
ALWAYS ALWAYS ALWAYS ALWAYS call glLoadIdentity() before defining a projection matrix! I learned that the hard way! If you don’t, everything screws up severely if the code is called a second time.
Just a warning, so no one else wonders why everything suddenly shrinks after they resize their window.