[GEM-dev] rectangle texture coords in GLSL shaders

cyrille henry cyrille.henry at la-kitchen.fr
Thu Aug 30 11:28:38 CEST 2007


hello,


solution 2) look obvious. 
the pd stuff that need to be add in the patch can be made as an abstraction. 
so, i vote for solution 2, with a standard variable name (like 'TextureUnit1Dimensions' or 'TextureUnit1Dim').

cyrille

chris clepper a écrit :
> In order to make certain texture manipulations work using rectangle textures
> (sampler2DRect) the shader needs to know the absolute pixel dimensions of
> the image.  The only way to do this is to pass the shader those values from
> an outside source.  The two methods I have figured out are as follows:
> 
> 1) Create a reserved uniform variable like 'TextureUnit1Dimensions' and pass
> the dimensions from the GemState to any shader with that uniform in the
> shader.
> 
> 2) Use pix_info to read the dimensions and pass them to the shader using a
> message to glsl_program.  The shader just needs a uniform vec2 that matches
> the message.
> 
> The first one is more automagic but it requires knowing the exact magic
> variable name(s) to make working shaders.  The second follows the Pd
> paradigm better and allows for the shader to use any name for the uniform.
> 
> I'm leaning to the second option as the most flexible and sensible even
> though it probably presents a higher margin of user error and makes for
> additional patch clutter.  It also requires no change to the existing code!
> 
> Thoughts?
> 
> cgc
> 
> PS- This came up while working with Anton to get the vade shader set fully
> functional in GEM.  These changes will make that happen.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> GEM-dev mailing list
> GEM-dev at iem.at
> http://lists.puredata.info/listinfo/gem-dev




More information about the GEM-dev mailing list