Hi all. I've been having some weird issues with my code, and I can't figure out what exactly is happening. My goal is to call a previously created display list and have it appear in a location that is advantageous to the viewer.
What I'm currently trying:
Code :glLoadIdentity(); glScalef( 1.0f, 1.0f, -1.0f ); // Make the object upright glRotatef(180,1,0,0); glRotatef(90,0,1,0); // Move the object so the "camera" can see it glTranslatef(XDistance, YDistance, ZDistance ); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glCallList( ListId ); glFinish();
Basically, I have some code that will vary XDistance, YDistance and ZDistance based on user input, which will then move the "view" of the object drawn. If I vary YDistance, the object will move up or down in the plane of view, and if I vary ZDistance, the object will move right or left in the plane of view.
However, if I vary XDistance, the object does not appear to move forward or backward (the only remaining axis), but instead seems to move the visible display box forward and back (more clarification: Say I start with x = 0. The apple tree I'm rendering appears in its entirety. If I move x = 1, the apples in the rear of the tree [along with the rest of the rear of the tree, the apples are just the easiest to identify] are not rendered. If I move x = -1, the rear apples are rendered while the close ones aren't. ).
I've tried adding calls to glFrustum and glProspective, with no success (glFrustum has no visible effect and glProspective prevents all rendering).
So I guess I have a couple of questions. One, why is my stuff getting "clipped" when I vary translation in my XDirection. And two, why does translating in XDirection have such a different effect than translating in either YDirection or ZDirection.
Thanks much for your time and help,