Structure for GL tools (quad)

kimba23's picture

Hi. How so I go abuot creating a structure that works with the gl tools? I tried the structure makers. But the structure makers do not output a structure similar to the "get mesh component" I would like to set some sprites in space using the interaction patch with the mouse and then use the coordinates of those sprites as "vertices" that I can input in the gl quad structure patch so I can create some complex geometries made with quads. The idea is tha I can create a kind of mask that I can use for projection mapping on a object made with a lot of real cubes Any help would be apreciated! Thanks. Oh I am not so good with javascrpt :0( but I can learn by example. :)

Comment viewing options

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

pixelnoizz's picture
Re: Structure for GL tools (quad)

i think the Kineme GL grid generator and renderer are handy for this kind of mapping things. Or the one by Memo: http://www.memo.tv/projection_mapping_quad_warping_with_quartz_composer_...

franz's picture
Re: Structure for GL tools (quad)

if you want to construct funky geometry on the fly, i guess you'd better use a queue patch to generate a serie of structures suitable for GLquad structure patch.

kimba23's picture
Re: Structure for GL tools (quad)

thanks monkeypresso; I am aware of those tools. The problem is not so much about the tools (I could use quads structure, GL grid or memo's stuff) but about how to manipulate a pre-established structure (which i will write to a file) so when I load it, i can modify easily. I think the best way would be with a mouse so i can move the "vertices" so I can adjust the projection mapping quickly. I know there is a threat here that talks about how to replace elements on the structure of a GL grid, and in fact, I use some of that info in another project. But for this one, the object is so complex and I have so little time to set up that being able to quickly access coordinates in a structure and modify them, would be what I am looking for. That is why i thought of using interactive sprites as the vertices that will make the quads structure... Any help on how to this would be greatly appreciated, I will try to post some pictures of the object later so it is clear what i mean. Thanks again!

pixelnoizz's picture
Re: Structure for GL tools (quad)

yes thats true, but the texture for the GL quad structure will be difficult!

kimba23's picture
Re: Structure for GL tools (quad)

Thanks franz. I look into the queue, I dont know how to use it but if you got some examples i look at them... will also look into the dev examples and of course here in kineme. Thanks again!

gtoledo3's picture
Re: Structure for GL tools (quad)

That's really interesting franz. I would think to approach it by generating the mesh with javascript, and then multiplexing the source javascripts, with the multiplexer hooked to the Quad Structure. What would you feed the queue with, the same kind of javascript like I'm describing? I'm curious what you find the advantage of the queue to be in this scenario...thanks!

With the Quad approach, I'm not sure that there's any real way to texture....other than to use CI blend filters, and have the Quads be the mask or something. I don't know if that would be enough control of the image.

fsk's picture
Re: Structure for GL tools (quad)

i dont think you will be able to this without javascript. im working on something similar using the grid renderer. i tried it with the interaction patch but gave up because of some problem with interaction inside an iterator (cant remember exactly why).

i attached a basic example of how i do it now.

PreviewAttachmentSize
dragable points.qtz15.12 KB

franz's picture
Re: Structure for GL tools (quad)

with the queue you click the four corners of a quad. Each time you click, you queue in a XYZ(and eventually U,V,R,G,B,A,nX,nY,nZ) structure, where X and Y is your mouse coord. Every 4 structure recorded, you got a new quad.

Texture is okay if you want the same texture for each quad. If not, you can beg Chris so that the Quad Structure patch takes ImagesStructure as input (already discussed, doable but apparently boring) - or you can fiddle the UV coords by hand, provided you know the total number of quads you'll be drawing.

Hence no javascript needed

Modifying the quad structure afterwards is another tricky thing, but i remember we had a thread about Structure manipulations via javascript, where problems were finally solved in the end.

franz's picture
Re: Structure for GL tools (quad)

as a sidenote, you can manipulate a KnM GLgridStructure patch with the Grid Editor patch. It is specifically designed for this. Sorry not to have pointed it before... Here's a snapshot of the patch, in case ....

PreviewAttachmentSize
Screen shot 2010-01-07 at 6.47.45 PM.png
Screen shot 2010-01-07 at 6.47.45 PM.png31.65 KB

gtoledo3's picture
Re: Structure for GL tools (quad)

Oh, are you using the structure maker then? (Still trying to figure out what it is that turns the clicks+coordinate into a structure to feed the quad).

Yeah, I've been wanting image structure input to quad and point too... I think it's that the overhead would be pretty high, more than it being boring. I would still love it to be there, to at least see. I played with putting it in myself to the last published gl tools source, but couldn't get it going... I guess I should look again, because my understanding had grown since trying that.

franz's picture
Re: Structure for GL tools (quad)

yeah yeah, structure maker, of course.

As long as you don't feed the quads with 800*600 image structure , it should be ok. I would also love to have a ImageStructure input on that patch ! IMO it would be pretty handy.

gtoledo3's picture
Re: Structure for GL tools (quad)

No kidding... and for points, it would be cool, because you could "Draw" sequences of differing icons/textures as well; by making a few rows with an iterator, you could have stuff that looked like you were drawing simple scrolling landscape on the fly. (It wouldn't work for projection mapping since they always face front).

I don't know though, I think Smokris said something about thinking it would be taxing. I may have the wrong impression, or have misunderstood.

For a second I thought I was scratching my head, because I couldn't figure out how the heck you were creating the points if not with javascript- that's pretty cool. I shifted to javascript for making those kind of things for fear of the structure maker getting phased out in SL.

I like the idea of the whole "auto click" thing, saving the resulting structure, and then having a bunch of structures in the bag... lots of possibilities in that.

kimba23's picture
Re: Structure for GL tools (quad)

Thanks for the help. Last night I spend some time with the dragable points from fsk (thanks!). an It looks like I have something going. I will report back in the next few days... Thanks everybody! kineme Rocks!

Stammhirn's picture
Re: Structure for GL tools (quad)

Hey kimba23

I have the same problem. But i did it without Javascript. You can edit the square by pressing either „1“, „2“, „3“ or „4“. (For the four corners). With “S” you can store the coordinates. And with “L” you can load old stored coordinates.

Next time there will be a lot more quads. And a way how to handle it.

See you soon!

PreviewAttachmentSize
Edit SaveAndLoad a Gl Quad.qtz24.21 KB

kimba23's picture
Re: Structure for GL tools (quad)

THANKS!!! Stammhim, I give it a go later tonight! U da man

Scratchpole's picture
Image input/ Structure for GL tools (quad)

These are great examples thanks everyone. I'm having a play with dragable points and cannot work out how to get the image input/image structure working. From what I can read the javascript needs to include uv info, trying to copy and paste bits from the script in GL tools quad structure example but no luck yet. Hope someone can help, thanks in advance.

Scratchpole's picture
Re: Image input/ Structure for GL tools (quad)

OK problem solved I used Stammhims's example instead of fsk's and replaced the quad structure with _1024_perspective.

Dunno what I'm missing for it to save and load the coordinates though? So I chopped that bit out.

I have attached an example with two quads.

PreviewAttachmentSize
2xDragable_1024Perspective.qtz725.18 KB

Scratchpole's picture
Re: Image input/ Structure for GL tools (quad)

I realised you need Kineme file tools to load and save structures, I installed it and jobs a good'un.

Written instructions on a note: Uses mouse position to assign coordinates: Press keys 1-4 to set/edit quad coordinates 
When adding coordinates begin where you want the top left corner and move anti clockwise. Key 'L' to load a structure coordinate set Key 'S' to save a structure coordinate set

PreviewAttachmentSize
EditSaveAndLoad_1024_Perspective_Quad.qtz23.93 KB

Scratchpole's picture
Re: Image input/ Structure for GL tools (quad)

Could still use some help on this one please.

I set up a composition with 2x _1024_perspective sprites/quads and added enough struct inputs to the save and load macros but there is an issue with loading /saving the plist...

Is it because of the naming convention of the inputs on the struct maker? I have noticed that the original has postfixed the published key with proxy_1. How do you change the published key?

Maybe it's something else...? Thanks in advance. Joe

PreviewAttachmentSize
Picture 2.png
Picture 2.png38.68 KB
2x_ESL_1024_Perspective_Quad.qtz35.73 KB

bernardo's picture
Re: Structure for GL tools (quad)

hi fsk, thanks for the patch do you know how can i input a structure of points into this to make them draggable.... thanks ber

gab_lecup's picture
Re: Structure for GL tools (quad)

Hi there, I'm very interested in the subject, but am having trouble finding the patch you mention ... I figured out GLTools v0.4 include the grid generator and the grid renderer (whereas v1.6 doesn't ... at least i couldn't find it), but i can't find the grid editor ... do you have any idea where to look ??? thanks a lot.

smokris's picture
Re: Structure for GL tools (quad)

@gab_lecup, the Kineme GLTools Grid patches are hidden by default, since they never really got finished/polished.

To show these hidden patches in the Patch Library, hold the Option key while selecting Preferences... in the Quartz Composer Editor menu, then click the (System) tab, and enable QCShowPrivatePatches.