glsl and texture

DanieleCiabba's picture

I'm wondering if its possible to apply to a 3d obj a glsl effect and let its mantein his original texture...


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cwright's picture
Re: glsl and texture

short: yes

longer: the fragment shader needs to include a sampler2D (or sampler2DRect) to apply the texture. If you want lighting to work as well, you'll need to make the fragment shader + vertex shader work together to apply Lambertian shading + other lighting equations (there are examples of this out there -- including a really nice per-pixel lighting shader that looks very nice on curved surfaces).

(this is slightly different from using the texture input on the object itself -- that doesn't work due to QC's texture usage.)

Here's an example composition -- uses GLTools a tiny bit, but should work without.

glsl texture.qtz5.93 KB

dust's picture
Re: glsl and texture

nice example....

DanieleCiabba's picture
Re: glsl and texture

thanks... i'm playing with your patch... you are kind as always