I need to do a virtual swimming pool by OpenGL

I need to draw a virtual swimming pool for an experimental simulation, but I’ve two doubts:

  1. I tried to model the pool by: glBegin(GL_POLYGON); glVertex3f(…), …, …, glEnd(), but I wonder if it’s possible by auxSolidCylinder(…) .
  2. And, how to make impenetrable walls (so that the user can’t go through them).
  3. In order to navigate into the pool, which is the best way. For example, using gluLookAt(…) or exist other methods?
    Any suggestions and help will be welcome.

Hey those are 3 doubts not 2! :slight_smile:

  1. depends on how you want to make the pool like…
  2. You need collision detection.
  3. Theres GL ways as well (ortho? frustum?).

Try to use glu as less as possible… and if you can, supress it for your final “product”.

Actually there is nothing wrong with GLU, it is GLAUX (auxSolidCylinder …) you want to avoid.
GLAUX is discontinued and buggy like hell.

If you want a real simple pool, I would construct it from 5 GL_QUADS (the sides plus the bottom) and use a blue translucent quad as water. As simplefied collision check you could perform a simple 3d point-inside-3d box calculation where the 3d point is your x,y,z position and the 3d box is your pool. In order to “swim” around in your pool gluLookAt() should be sufficient.

Of course this can be extended to any complexity you like.

For further question you should use the “OpenGL coding: beginners” board on this site.