PDA

View Full Version : texture translation



dodgyposse
08-27-2002, 12:39 AM
I am writing a game which contains meshes,
in which I have pits filled with lava.

The lava is simply a texture which I am applying to certain polygons in the mesh.

I wanted to create a cheap effect, in which the lava appeared to flow down a channel,
and thought I could use the texture matrix to achieve it.

Sadly it doesn't appear to work.
i.e
The textured polys lie in the plane y=0;
And I thought I could translate the texture
a set amount each frame, wrapping the translation value back to 0.

float transX=0.0;

void shiftLava()
{
transX+=0.1;
if ( transX >1.0)
transX = 0.0;

glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef( transX,0,0);
glMatrixMode(GL_MODELVIEW);

// draw quads

glMatrixMode(GL_TEXTURE);
LoadIdentity();
glMatrixMode(GL_MODELVIEW);

}

But I am getting a strange effect, where a single line of the texture is stretched out

Is my theory sound?

dd

PH
08-27-2002, 03:03 AM
Stretched out ? Sounds like you are using GL_CLAMP for your texture wrap modes.