Page 1 of 1

More than one texture to shader

Posted: Sun Dec 17, 2006 6:20 pm
by coldo
How to pass more than one??

method "node->getMaterial(0).Texture2 = driver->getTexture"test.tga");"
doesn't work.

Posted: Sun Dec 17, 2006 7:27 pm
by coldo
I found solution, but it works only for OpenGL, which is on my computer
much slower than DirectX.

int a = 0;
services->setPixelShaderConstant("tex0", (const float*)&a, 1);
int b = 1;
services->setPixelShaderConstant("tex1", (const float*)&b, 1);
int c = 2;
services->setPixelShaderConstant("tex2", (const float*)&c, 1);


in shader, you use:
uniform sampler2D tex0, tex1, tex2;

Posted: Tue Dec 19, 2006 8:53 am
by TheC
for directX, multitexture your object using the Texture1 2 3 and 4 members.

In the shader put:

Code: Select all

sampler2D tex0 : register(s0);
sampler2D tex1 : register(s1);
Thats should work, it does here. Thanks to omaremad for that one ;)

Posted: Wed Dec 20, 2006 4:41 pm
by coldo
Well, it works!!!! :D

tnx so much