I’m only drawing a single object in my model and trying to rotate it. I clear the screen, set gluLookAt(view), call glMultMatrix on my arcball tranform(model), and draw it. AFAIK, this is as simple as it can get.
I call glOrtho() (my projection transform) after the model/view transforms and before I draw my model. Becaue I only have a single object to draw … I don’t see the need to use matrix stacks (other than change between modelview and projection), but my model is disappearing now and I have a feeling it’s the order of stuff I do in my display().
My test code looks like this …
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
// reset the modelview matrix
gl.glColor3f(1.0f, 1.0f, 1.0f);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
// Viewing transformation.
glu.gluLookAt(0, 0, getZScale(),
centroid.getX(), centroid.getY(), centroid.getZ(),
0.0, 1.0, 0.0);
// Modeling tranformation, w/ my arcball transform.
arcBall.getTransform().get(transf);
gl.glMultMatrixf(transf);
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(-winWidth / 2, winWidth / 2, -winHeight / 2, winHeight / 2, 100, -100);
// Draw model.
{
drawModel(drawable);
}
All I’m trying to do is incr/decr the eye z coord in my gluLookAt for zooming in and out of the model and some rotation control. But even changing this value doesn’t change the position of the camera it seems.
I don’t think my arcball tranform is the problem. I think that works. But I now think it’s the way/order I’m doing all this. Currently, my model either dissappears when I start a drag operation, or just won’t show up.
Anyone have ideas/comments on what I’ve got above?