Sign in to follow this  

problem with frustum culling

This topic is 4688 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I need some help with the subject. I have read countless articles on it on the web. It seems that everyone claims to work but not for me!! I am using the common method used by many as follows: calculateFrustumPlanes { projection = glGetFloatv(...) // Get current projection matrix modelview = glGetFloatv(...) // Get current modelview matrix clip = modelview * projection // Get clipping matrix ... // Calculate each of the 6 planes } The above pseudo-code does not work for me at all. After comparing with other online tutorials, I noticed some differences. My codes are using gluPerspective and gluLookAt as follow: glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(...); gluLookAt(...); Once I modify those working tutorial codes with gluPerspective and/or glLookAt, every thing does not work anymore. Now, I believe these 2 modification on the projection matrix does play an important role on what clip plane I get. So I tried a transpose on projection matrix as follow: calculateFrustumPlanes { projection = glGetFloatv(...); // Get current projection matrix modelview = glGetFloatv(...); // Get current modelview matrix projection.transpose(); clip = modelview * projection; // Get clipping matrix ... // Calculate each of the 6 planes with normalization } With the transpose, things gets better: I can see some objects pop-in/out as I rotate my camera. However, the frustum seems to be in the opposite direction and position compared to the actual camera. I would appreaciate if someone advise me on what additional tweak I have to do to rectify me problem. Do I have to perform a further inversion to offset the transformation done by gluLookAt()? I am rather frustrated as much time have been wasted on this irritating bug of mine.

Share this post


Link to post
Share on other sites

This topic is 4688 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this