> Just curious - I have a jit.gl.sketch drawing lots of concentric
> spheres, and it would be great to apply shaders to some of those
> spheres but not all.
In this case, I would be includes to use a gridshape with @automatic 0
and multiple draws. If you have 2+ gridshapes, you can assign them
differenct shaders or none at all. You just need to manage scale and
positioning. I posted some JS stuff in javscript-dev that outlined
how to do this.
> True, that's one way. I was thinking more of applying shaders to
> different objects in a sketch cmdlist, like (in psuedo-code):
> 1. enable texture
> 2. use texture
> 3. use shader (from jit.gl.shader)
> 4. draw sphere or other shape
Actually there's (undocumented) code in place for binding shader
programs in jit.gl.sketch. The commands are glbindprogram
, and glunbindprogram (which is equivalent
to glbindprogram with no argument). So, assuming you have an instance
of [jit.gl.shader @name shady] in your patch, something like the
following should work. At bottom is a simple example with a similar
program, plus some extra bells and whistles to make it look better.
Note that you can also bind/unbind textures in a similar fashion with
glbindtexture . To unbind, you would
provide no argument. In fact you can actually implement
something like slab with these commands if you set up the modelview
transform and geometry properly. FWIW, before we made a C object for
jit.gl.slab, we prototyped it with jit.gl.sketch.
that's awesome joshua, that's just what i was hoping for.
and to answer wesley (and anyone else who is interested), i'm using
jit.gl.sketch because it allows you to draw and texture multiple shapes
at once, and then with the capture attribute, you can render it to a
texture and then put it through a series of slabs and such. since you
can't render only a group of jit.gl.gridshapes together and have them
capture to a single texture (as far as i can figure out), you need
sketch. i have a massive patch that uses this to create a series of
versions of a single sketch rendering, and then i use a crossfader slab
to fade between each for seamless fx blending between each rendering,
plus other layers of gridshapes mixed into the final scene. very hot.
even at 640x480 for each texture (explicitly set using @dim 640 480),
it runs incredibly well on my 2 year old powerbook.
one odd thing - in the example patch in your email, changing the X,Y,Z
values in the "moveto X Y Z" line makes no difference on my machine,
jitter 1.5.2 in OS X 10.3.9. is that because of my admittedly
incomplete understanding of OpenGL? it'd be great of you could explain
why it works like that, or if it's not supposed to work like that...
This gives a technique for using the "to_texture" message for capturing a scene to texture. I would imagine that using jit.gl.sketch is probably your most efficient option anyway, so it sounds like you are doing fine. I would love to see the results.
and one question about coordinates:
which is the best jitter-object for tracking movement, if the
movement is supposed to be sent as coordinates (x,y) to another
programme like flash ?
im looking something similar to what eyesweb has for tracking ,....
Have a look at http://www.mat.ucsb.edu/~whsmith/jool.html . There you
fill find a Codewarrior project for doing C++ in jitter. If you're
working on Windows, check out the jit.atari2600 posts. Kyle, who
wrote the external, has bee doing C++ in Jitter in Visual Studio. If
you ask, I bet he'll send you the project and you can use it as a
starting point for doing C++ in Jitter on windows.
I am working with "to_texture" by the moment, does the "capture" keyword
also copy the current rendered scene in the front buffer into the using
texture or it does other tricks ? It would be great if it can capture an
I have been looking into the documentation and seems there is alot hidden
command I can cast on the jit.gl.sketch object. Anyone know if there is a
compete list of usable commands ?