looking for glsl examples with multiple textures


    Aug 30 2006 | 1:10 pm
    hello, i'd like to have access to multiple textures inside the fragment progarm of my glsl script. i'm looking at things like the compositing examples with jit.gl.slab and i see that the two textures enter the object from its two inlets, and within glsl are refered to using
    // texcoords varying vec2 texcoord0; varying vec2 texcoord1;
    // samplers uniform sampler2DRect tex0; uniform sampler2DRect tex1;
    what i would like to do is apply a shader to a thing i'm rending with jit.gl.mesh; what i'm not sure about is how to access the textures and how they will be numbered. my intuition is, if i want two videos as textures, i use two jit.qt.movie's and two jit.gl.textures and name them differently, and then tell jit.gl.mesh "textures mytext1 mytext2". but i can't find any examples that make user of multiple textures, in jitter, without jit.gl.slab.
    would someone be able to point me to some existing patches?
    thank you, a

    • Aug 30 2006 | 3:48 pm
      @texture tex0 tex1 will work. The order you specify textures in will correspond to the texture integer number. For instance if I have this at the top of my shader:
      , it will be the first texture in the list. If I have this:
      it will be the second texture in the list.
      wes
      On 8/30/06, Ali Momeni wrote: > > > > hello, > i'd like to have access to multiple textures inside the fragment progarm of my glsl script. i'm looking at things like the compositing examples with jit.gl.slab and i see that the two textures enter the object from its two inlets, and within glsl are refered to using > > // texcoords > varying vec2 texcoord0; > varying vec2 texcoord1; > > // samplers > uniform sampler2DRect tex0; > uniform sampler2DRect tex1; > > > what i would like to do is apply a shader to a thing i'm rending with jit.gl.mesh; what i'm not sure about is how to access the textures and how they will be numbered. my intuition is, if i want two videos as textures, i use two jit.qt.movie's and two jit.gl.textures and name them differently, and then tell jit.gl.mesh "textures mytext1 mytext2". but i can't find any examples that make user of multiple textures, in jitter, without jit.gl.slab. > > would someone be able to point me to some existing patches? > > thank you, > a > > >
    • Aug 30 2006 | 4:13 pm
      In the Jitter Tutorials, there is a 4-input compositing example using jit.gl.slab. I recommend having a look at the accompanying shader.
      Andrew
    • Aug 30 2006 | 4:28 pm
      yes yes, i'm aware of that one; i was wondering if there are any examples of shaders applied to an object creating geometries like a jit.gl.gridshape or a jit.gl.mesh or somethin, and then a fragment shader that uses multiple textures from jitter.
      but along with what i tested and what wes pointed out, i just tried it out and it looks like it works just fine with my shader applied to a jit.gl.mesh geometry. i have access to multiple textures as long as i have multiple named jit.gl.textures and i send a "texture tex1 tex2..." message to jit.gl.mesh. excellent; it's all very exciting this shader business; one can do real-time video on an apple computer after all.
    • Aug 30 2006 | 4:32 pm
      Don't overlook the math (op.*.jxs), composite (co.*.jxs), and transition (tn.*.jxs) shaders...
      -Joshua
    • Aug 30 2006 | 4:35 pm
      On Aug 30, 2006, at 9:28 AM, Ali Momeni wrote:
      > yes yes, i'm aware of that one; i was wondering if there are any > examples of shaders applied to an object creating geometries like a > jit.gl.gridshape or a jit.gl.mesh or somethin, and then a fragment > shader that uses multiple textures from jitter.
      Nothing about these shaders that are slab specific. You can apply a shader to any geometry (slab just has some special viewport aligned geometry rendering to its own context), and then just use a multitexture texture attribute. These slab focused shaders just don't do some of the common things like lighting calculations, but you can add that in if you like.
      -Joshua
    • Aug 30 2006 | 4:42 pm
      > one can do real-time video on an apple computer after all. >
      More than that, one can do HD compositing on an apple with quite a number of filters applied.
      wes