Viewport panning

Howdy,



I’m working on a camera class that allows for viewport panning by changing the left, right, top, and bottom values of the frustum.



It’s working they way I need it to except for scene graph culling. I don’t understand the math that handles it so I may have a little trouble communicating the problem. I’ve tried to make some adjustments myself, but I haven’t had any luck so far.



What’s happening is when the frustum values, left and right, are not equal it doesn’t cull the object in the scene graph at the expected place. It’s like the culling calculation doesn’t take into account the possibility of the frustum values not being equal for each side.



I guess another way to say it might be when the frustum values aren’t equal the scene graph culling is off by the amount of the offset from the center of the viewport.



Does this make sense? I’m sorry for my less than adequate description of the problem.



Thanks,

Gregg

You can see an example of what I’m describing by adding .3 or so to the left and right camera frustum values in TestBoxColor.java. Then strafe left (‘A’ key). The box gets culled about two thirds of the way across the window.



Gregg

Hmmm, I’ll see if I can figure out where the problem is occuring. I’ll get back to you.

The bounds seem to be working correctly, the problem appears to lie in the camera itself… The distance from the bounds to the Frustum plane cuts to zero when the object disappears (as it should)… On the opposite side, the object is still drawn even when its bounds are off screen…



I’m wondering if we are misunderstanding how the frustum works… our calculations for determining the location of the planes that make up the frustum only seem to work when centered (ie, l/r t/b need to be equidistant from a center point.)



Thus, I can’t say for sure at this point, however it seems that our problem lies with the actual frustum plane locations (or perhaps the distance method of Plane.)



On the other hand, OpenGL could simply be readjusting the viewport to be correct to some internal protocol (some frustum related methods do this) and thus what we are seeing and what our data points say we should be seeing may not match.