stupid question about texturing techniques

ok, here’s a no-brainer that should be relatively easy to solve. I’m actually a bit embarassed to be posting it, but a small bit of humiliation is worth a few hours of dev time.

I would like to create a liquid effect on a single, large textured quad ( tri-strip, whatever ). A great example of the effect I’m looking for is the intro screens on the LDA game, “Treadmarks.” I’ve done a bit of research on liquid/glass modeling, and they all seem a bit of overkill. Since this effect has been do in so many different applications, I am led to believe that there is a general technique to doing so…

Is the basic technique to just tesselate the large quad close to pixel accuracy and manipulate the texcoords with a sine/cos flavoured wave?

I apologize for being lazy, but I don’t make a living through OpenGL and lately, time hasn’t been in abundance.

I’d greatly appreciate any information on this subject. Please, however, don’t point me to the nVidia website. I’m looking for a vanilla 1.1 implementation here, and while some may argue that even 1.1 can be dependant on extensions, you know what I mean

Thanks in advance,

Simulating water is hardly simple. Researchers are still trying to get water right on high-end rendering apps. If you want to do anything even slightly decent with it, it’s going to require either multitexture or multipass (ie slow). A single texture isn’t going to do the job correctly.

I must have explained myself incorrectly. I am not looking for an accurate representation of water/liquid or anything that complex, just a simple, procedural texture effect to distort the image. Perhaps I am oversimplyfing the process.


u wanna do someit like quake2/3 etc does i assume
u could alter the texture coordinates yourself or let opengl do it heres how.

glMatrixMode( GL_TEXTURE );
// and now use any of scale/rotate/translate/multmatrix etc
to change the textures flow

static float Xdif = 0.0, Ydif = 0.0;
float offX = sin(Xdif+=0.01);
float offY = sin(Ydif+=0.02);

glTranslatef( 0.5 + offX, 0.5 + offY, 0 );
draw quad

glMatrixMode( GL_MODELVIEW );

the above should hopefully produce something u want.

perfect, that’s exactly what I was looking for.


hello, i have tried this code, it works fine, but :

all the textures are moving, and i just want the binded texture to move.

i may have forgotten something,if you can help, tanks.


You need to reset the texture matrix to an identity matrix after you have drawn your water surfaces.

sorry i should of mentioned that u can also do this as well

glMatrixMode( GL_TEXTURE )

glMatrixMode( GL_MODEL_VIEW )

tanks, that’s works

just a question : what is a static variable?
i think it’s just created once, but i’m not sure.