## Torus

Not entirely certain if this is the right place. I'm giving a seminar presentation on Morse Theory, and part of this involves an example with a function (actually, set of functions) which acts on the surface of a Torus. I have a function f(x,y,z,t) which when given a value on the torus and a time t will define what color I want to set that point.

The problem is that the behavior of this function on a small scale is rather crucial. Two "sections" of the torus coming together at a corner can't look like they are doing so in a more parabolic fashion, and vice-versa. So far I've been trying to increase my polygon count, but I'm at the limits of my laptop and it's still not really as nice as I want it.

Right now I'm defining the torus with GL_QUAD_STRIP and using display lists. So for each time t, I need a different list because at each different point in time the function f will result in coloring the torus a bit differently. 100 or so such lists will be sufficient.

An example of such a function is simply:

f(x,y,z,t) gives red if z < k(t), blue otherwise, for some function k(t).

There are a few more functions like this, each a bit more complicated, but that's the main idea. So is this the right way to be going about this? Or is there something more efficient I can do?

What I'm going to attempt next is to write an adaptive algorithm so that my polygon count increases at certain points on the torus.