Texture Flipping

Started by dear_stephen, May 30, 2007, 10:57:08 AM

Previous topic - Next topic

dear_stephen

Hi there!

It appears that textures are tiled by default. How would I go about flipping the texture instead of tiling it as my uv coordinates run over the edges of my texture?


Cheers,
Stephen

EgonOlsen

You can't. OpenGL supports tiling (default) and clamping. Software (in OpenGL-look-alike-mode) supports tiling only. How about adding the "flipping" effect to the texture itself if changing the texture coordinates accordingly isn't an option for whatever reason.

dear_stephen

I originally had the flipping code working in another graphics engine. However I had strange artifacts in JPCT. I guess it should work as you say though. I was just hoping there might be a method like object.setTextureMode(Object3D.FLIP).

I'll have another look at getting my old code working in JPCT.

Thanks

EgonOlsen

Maybe you can post a screenshot just to make sure that we are talking of the same thing when speaking about flipping and tiling. I'm not sure that we do...

ToddMcF2002

I've been pretty puzzled about UV texture manipulation too.  For example - I've seen some GL engines implementing a waterfall by moving a seamless water texture across a plane object.  Looks very effective and it can't be too expensive.  They have to be manipulating the UV!  unless they are simply moving/resizing the plane but I don't think so....

There has to be a way to do it.
 


EgonOlsen

Quote from: ToddMcF2002 on May 30, 2007, 08:24:51 PM
There has to be a way to do it.
Of course there is. You can use the PolygonManager for this. But i don't think that this is, what Stephen is talking about.

ToddMcF2002

Yup I guess I'm confused about the difference between moving and flipping.

dear_stephen

Hi Guys

Lets say this is my texture.


Then tiled would looke like...


...and flipped like...



However I realise now that tiling gives a better result. With flipping, when the coordinates run toward the ends of the texture uneven stretching can occur. In the worst case two neighbouring verticies can have the same texture  coordinate, resulting in pixels being stretched from on vertex to the next.

It is better to use tiling and to make the textures seamless.



EgonOlsen

Yep, it's better to do it that way. "Flipping" is also unknown to OpenGL. There are clamping, clamping to edge and tiling only.