I’m back, and I have a rather strange problem that I’m hoping someone can help me with.
I’ve recently started a new project and based it on code I’ve had working under LWJGL 0.6, I’m now using 0.8 (I’ve also switched from Java 1.4.2 to 1.5b).
The problem is this when I rotate my camera, the edges of my frustum come into view and I can see what was previous clipped.
My camera update code looks like this
GL.glMatrixMode(GL.GL_MODELVIEW);
GL.glLoadIdentity();
GLU.gluLookAt(m_Position.x, m_Position.y, m_Position.z, m_CurrentLookAt.x, m_CurrentLookAt.y, m_CurrentLookAt.z, m_LookUp.x, m_LookUp.y, m_LookUp.z);
and the first part of my calculate frustum code is as follows
GL.glGetFloat( GL.GL_PROJECTION_MATRIX, projBuf);
GL.glGetFloat( GL.GL_MODELVIEW_MATRIX, modlBuf);
projBuf.rewind();
modlBuf.rewind();
projBuf.get(proj);
modlBuf.get(modl);
I call them in my render loop
camera.update(); // does a glLookAt() current view
calculateFrustum(); // as described in this thread.
// render code with fustrum testing goes here.
So what I see is the same view (terrain in this case) frustum culled but then rotated into view.
I’m not explaining this very well, so here is a screenshot, my terrain in this shot has been rendered and I’ve rotated the view, and instead of getting the rest of my terrain, I get empty space. my current x, y coordinates put me i the center of my heightmap, not in a corner.
http://games.swizel-studios.com/images/screenshots/terrain00.png
Anyone got any ideas what I might be doing wrong, it’s probibly something really stupid, I have code that I can show if that’ll help.
Thanks,
Andy.