PDA

View Full Version : stupid question about texturing techniques



lpVoid
08-31-2001, 04:49 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

Thanks in advance,
Dave

Korval
08-31-2001, 07:44 AM
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.

lpVoid
08-31-2001, 09:44 AM
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.

Dave

zed
08-31-2001, 02:33 PM
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.

lpVoid
08-31-2001, 02:57 PM
perfect, that's exactly what I was looking for.

Thanks!
Dave

MarsuGL
09-02-2001, 12:02 PM
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.

Marsu

DFrey
09-02-2001, 12:15 PM
You need to reset the texture matrix to an identity matrix after you have drawn your water surfaces.

zed
09-02-2001, 12:47 PM
sorry i should of mentioned that u can also do this as well

glMatrixMode( GL_TEXTURE )
glPushMatrix();

...

glPopMatrix();
glMatrixMode( GL_MODEL_VIEW )

MarsuGL
09-02-2001, 02:07 PM
tanks, that's works http://www.opengl.org/discussion_boards/ubb/smile.gif

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