UV scale/rotate/tiling without shaders

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
alko
Posts: 26
Joined: Wed Aug 29, 2018 10:14 am

UV scale/rotate/tiling without shaders

Post by alko »

How to change texture UV coords on plane-mesh without help shaders (because i need to launch on retro-pc with voodoo 3dfx).
Also i need to enable flag GL_REPEAT (for unlimited scroll texture)

Image
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: UV scale/rotate/tiling without shaders

Post by CuteAlien »

There's 2 ways. First meshbuffers are made of vertices, usually S3DVertex: http://irrlicht.sourceforge.net/docu/st ... ertex.html
So it's possible to change the TCoords in there.

The other way is going over the material when drawing. SMaterial has a setTextureMatrix function which allows you set a matrix which modifies the texture drawing.

SMaterialLayer (in SMaterial you got a member TextureLayer which has one SMaterialLayer per texture) has TextureWrapU and TextureWrapV members. They can be set to irr::video::ETC_REPEAT, thought that is the default already so you'll only need it to set one of the other E_TEXTURE_CLAMP values: http://irrlicht.sourceforge.net/docu/na ... f84b39811f
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
alko
Posts: 26
Joined: Wed Aug 29, 2018 10:14 am

Re: UV scale/rotate/tiling without shaders

Post by alko »

I'm trying this

Code: Select all

 
float scroll;
...
//main loop
scroll += 1;
fognode->getMaterial(0).getTextureMatrix(0).setTranslation(vector3df(scroll,scroll,0));
...
 
but no result
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: UV scale/rotate/tiling without shaders

Post by CuteAlien »

Yeah, that's for 3d transformations. Look at all the matrix functions which have "texture" in the name, those will work with the kind of matrix you'll need here.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
alko
Posts: 26
Joined: Wed Aug 29, 2018 10:14 am

Re: UV scale/rotate/tiling without shaders

Post by alko »

Strange...
Rotation and scaling is work (setRotation (), setScale() ) .
But scrolling does not work.
Hmm...
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: UV scale/rotate/tiling without shaders

Post by CuteAlien »

Do you try to do that at the same time? If so - don't. I've not checked right now, but could be values do overwrite each other and you can only set them independent and then mulitply the matrixes to get a combined result.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
alko
Posts: 26
Joined: Wed Aug 29, 2018 10:14 am

Re: UV scale/rotate/tiling without shaders

Post by alko »

CuteAlien wrote:Do you try to do that at the same time?
Nope. I use this functions separately

by the way, engine version is 1.7.3 (for run under win98SE)
maybe there are bug in this version?
alko
Posts: 26
Joined: Wed Aug 29, 2018 10:14 am

Re: UV scale/rotate/tiling without shaders

Post by alko »

:o

Code: Select all

fognode->getMaterial(0).getTextureMatrix(0).setTextureTranslate(scroll,scroll);
it's worked
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: UV scale/rotate/tiling without shaders

Post by CuteAlien »

Ah good. And I thought Irrlicht 1.8 also still runs on Windows98, didn't know there are any troubles.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply