Material shader for Texture

Ad.'s icon

Hi,
I would like to apply to a gl.mesh's texture (it could be a videoplane texture too !) materials shader (mat.glass,…)

I've tried to bind the texture and set sampler2DRect…
But I'm pretty newbie in gl.shader…

Any help would be pretty appreciated.

Thx.

Ad.

efe's icon

something like this?

Ad.'s icon

Thank you for your response;
If i use your code as a single shader, it gives nothing else than a back sea !

Is this more like a program that I would have to bind in the futures shaders ?

Ad.

Rob Ramirez's icon

a few issues with the shader.
a single texture parameter should be bound to int 0, not int 1 (assuming you only have one texture bound).
second, for rectangular textures you're going to want to multiply the texcoord by the gl_TextureMatrix before sending to the fragment shade.

here's modified shader code and a simple test patch:

save as simple.jxs:

Max Patch
Copy patch and select New From Clipboard in Max.

test patch

efe's icon

Good one rob!

efe's icon

Is the previous example working with sampler2D?