View Full Version : infinite waterplane problem

12-16-2010, 04:16 AM
I'm trying to implement an infinite waterplane. I was considering 2 possibilities:

a) a huge rectangle of maximum dimensions allowed by the floating point numbers,
b) calculating the AABB of the frustum, then flattening it into a rect, and then drawing the rect

I decided for choice b). But the problem is that the rect can change with every modelview and projection matrix change. Therefore I need to upload new vertices (just 4 but still) into a DYNAMIC_DRAW VBO every time this happens. Should I have used option a) instead or have used client arrays? Maybe what I am doing is unusual?

Additional problem: I am using Dark Photon's caching VBO, which means the 4 vertices will slowly fill up the cache eventually orphaning the caching VBO.

12-16-2010, 06:25 AM
Could you just not create a plane(rect), with dimensions equal to the farDist-campos by far's width, that follows the camera just as a Skybox would.

Init the plane from frustum, and only need to updated if the frustum is updated(fov, aspect, near/far) - which would be minimal if not never.

12-16-2010, 07:41 AM
Good idea, but the frustum can be arbitrarily oriented, so you need to make the quad's edge length 2 * GetF(frustum), to fully contain the frustum, I think. Still, this would probably make for a bit larger rect than a flattened frustum AABB would, but require no AABB and no VBO updates.