[PD] GEM: multitexturing in GEM

chris clepper cgclepper at gmail.com
Wed Jul 11 19:03:46 CEST 2007


I have attached a very simple patch and shader for adding two textures together.

The shader needs to be loaded after window creation and rendering
starts to work correctly.  The shader has some basic comments about
what the commands do.  You can replace the ADD with MUL to get a
different effect to get started.
-------------- next part --------------
!!ARBfp1.0

#basic multi-texture shader
#adds two textures together

#Declarations
TEMP tmp, tmp1;
TEMP curr;


#grab the texture coords
ATTRIB tex = fragment.texcoord[0];
ATTRIB tex1 = fragment.texcoord[0];

#set output
OUTPUT out = result.color;

#pick which texture unit to get the pixels from
#texture[x] selects the texunit
TEX tmp, tex, texture[0], RECT;
TEX tmp1, tex1, texture[1], RECT;

#simple addition of the pixels
ADD out, tmp, tmp1;

END
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2shader_test.pd
Type: application/octet-stream
Size: 1617 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20070711/0bf767d8/attachment.obj>


More information about the Pd-list mailing list