More than one texture to shader

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
coldo
Posts: 8
Joined: Wed Dec 06, 2006 9:38 pm

More than one texture to shader

Post by coldo »

How to pass more than one??

method "node->getMaterial(0).Texture2 = driver->getTexture"test.tga");"
doesn't work.
coldo
Posts: 8
Joined: Wed Dec 06, 2006 9:38 pm

Post 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;
TheC
Posts: 93
Joined: Fri May 05, 2006 7:50 am

Post 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 ;)
coldo
Posts: 8
Joined: Wed Dec 06, 2006 9:38 pm

Post by coldo »

Well, it works!!!! :D

tnx so much
Post Reply