Results 1 to 9 of 9

Thread: stupid question about texturing techniques

  1. #1
    Member Contributor
    Join Date
    Feb 2001
    Location
    washington, dc usa
    Posts
    77

    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,
    Dave

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,574

    Re: stupid question about texturing techniques

    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.

  3. #3
    Member Contributor
    Join Date
    Feb 2001
    Location
    washington, dc usa
    Posts
    77

    Re: stupid question about texturing techniques

    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

  4. #4
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: stupid question about texturing techniques

    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.

  5. #5
    Member Contributor
    Join Date
    Feb 2001
    Location
    washington, dc usa
    Posts
    77

    Re: stupid question about texturing techniques

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

    Thanks!
    Dave

  6. #6
    Member Contributor
    Join Date
    Jul 2001
    Location
    France
    Posts
    80

    Re: stupid question about texturing techniques

    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

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,502

    Re: stupid question about texturing techniques

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

  8. #8
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: stupid question about texturing techniques

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

    glMatrixMode( GL_TEXTURE )
    glPushMatrix();

    ...

    glPopMatrix();
    glMatrixMode( GL_MODEL_VIEW )

  9. #9
    Member Contributor
    Join Date
    Jul 2001
    Location
    France
    Posts
    80

    Re: stupid question about texturing techniques

    tanks, that's works

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

Similar Threads

  1. stupid stupid question - Installing OpenGL?
    By JonnyW in forum OpenGL: Linux
    Replies: 3
    Last Post: 02-01-2004, 05:44 PM
  2. Quite a stupid question, but anyway...
    By ID_t1000 in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 01-29-2003, 05:26 AM
  3. stupid question about texturing
    By miko in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-29-2002, 08:25 AM
  4. stupid question
    By mochi in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-26-2001, 08:24 AM
  5. Maybe a stupid question
    By KurtCob in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 12-22-2000, 07:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean