So, I would like to use a shader with irrlicht with the following line:
texture BaseTex;
How can I pass a texture to the shader? The setVertexShaderConstant function is just for matrices, and vectors, isn't it? My question is probably newbish, but I cant find it out. Please help!
How to pass a texture to a shader?
Re: How to pass a texture to a shader?
If you want to use shaders,you can set them up as the material type,Joe Red wrote:So, I would like to use a shader with irrlicht with the following line:
texture BaseTex;
How can I pass a texture to the shader? The setVertexShaderConstant function is just for matrices, and vectors, isn't it? My question is probably newbish, but I cant find it out. Please help!
when you set the material texture...Like this:
node.SetMaterialTexture(0, BaseTex);
node.SetMaterialType(MyShader);
if you need more info about defining the shader:
http://irrlichtnetcp.sourceforge.net/ph ... hlight=cel
Its a little more complicated, in the shader you do:Kalda wrote:And how do this in GLSL?Joe red in HLSL you do this:
sampler2D myTex : register(s0) ; // (Before the pixel shader function)
This will set meTex to the first texture loaded in your model in irrlicht.
You can do s1, s2 and s3 for the second, third and fourth textures.
Cheers
uniform sampler2D myTex;
and when you pass a constant thats the name of the texture (myTex) and is the number of the texture on the model (so 0, 1, 2 or 3).