openGL 2 CL vertex parser with javascript array data.

dust's picture

first off i want to tell people about my new website http://pixel8r.info this is my personal home blog dynamic dns server that i will be filling with all my quartz composer experiments as well as other cross-modal interactive patches and or related interdisciplinary abstracts.

today i made a openGL2CL writer, or well made a program to parse out the individual structures of vertex, uv and normal data from an openGL mesh header file. This is so I can manually populate vertex data through JavaScript. The problem I am running into is I am unable to do the java equivalent of System.out.println meaning i want to write all my arrays to a file so i can copy and past the correct format into java script. When i try and write a file it seems to only write one index at a time and overwrites the previous line with the new line. so I want to write a file but do /n or carriage return. Is the string file writer the appropriate method for this ?

So I made a patch that is spitting out arrays as well as arrays or structures of the original columns and rows of the vertex data which seems like i could just feed them into javascript to make a structure or pass through as variables. i would like to be able to use the file writer though. Any suggestions.

You can download and view my meshWriter GL2CL structures by the following link.

http://pixel8r.info/index.php/comps/mesh

PreviewAttachmentSize
openGLHeaderMeshWritter.qtz99.91 KB

Comment viewing options

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

dust's picture
Re: openGL 2 CL vertex parser with javascript array data.

just want to iterate that this composition is for leopard and open cl & cuda development it is not intended for snow leopard beta testing although it could be used for those purposes i would like to keep any replies related to the current os as well as figure out how to write a structure to a file in qc with existing sources.

offonoll's picture
Re: openGL 2 CL vertex parser with javascript array data.

have you tried historean patch? it's the only patch that saves data to a plist file that I have worked with. It saves data in the object with the first member, time values, and second member values playing related to the time.

http://kineme.net/ValueHistorianPatch20090114beta

EDIT: you can see this sample. http://kineme.net/Discussion/DevelopingCompositions/RealTimebodydressand...

dust's picture
Re: openGL 2 CL vertex parser with javascript array data.

im not sure how to find the .plst file any suggestions ?

gtoledo3's picture
Re: openGL 2 CL vertex parser with javascript array data.

Checkout the settings parameter of the Value Historian. You can save and import. It's pretty awesome!

dust's picture
Re: openGL 2 CL vertex parser with javascript array data.

yeah thats pretty stupid of me its right there at the bottom of the patch. didn't get much sleep last night broke my glasses things are getting fuzzy. seems to be some useful data if i save the playlist out as a text from the .plst editor. some find and replace cleaning to do etc... but thats good to know the value historian can be used to write files and read them.. havent actually incorporated it into any of my work although i have ideas for it.

gtoledo3's picture
Re: openGL 2 CL vertex parser with javascript array data.

You'll love it, especially with the type of stuff that you get into. It was similar with me... I use it all the time (constantly!), and it took me a couple weeks to realize it was there when it first popped up, and I had to go "duh". If you don't use it too much, you probably wouldn't think of that in a million years.

Hmm. This makes me realize that I've never tried to save virtual data to file with the Value Historian... I woooonderrrrrrr.... I know it won't save it as "in- qtz" data across qtz saves, but it would be great if it saves it to file.

dust's picture
Re: openGL 2 CL vertex parser with javascript array data.

if you open in the plist editor save as type then open in x code and find these little things ", ), ( then replace with a empty space then your left with just the values. seems promising. if you think about it you could make a little code generator or something with qc string tools for things. i don't know it saves time sometimes to do things like that i don't know. in particular reference to this thread i just wanted to convert some c++ to java script without having to mess around with string libraries in code when you got pretty much everything you need in qc. i mean no need for an iterator to make a for loop when you can just bang through a structure index with an interpolator and hit record with VH do a little find and replace and save then viola you have your data set formatted.

so thats cool now i got the value historian writing my java script for me. you see it takes time to do all the fancy que structure reversals with indexing iterations just to read a C file in and well i don't really want to wait for 5 min for the computer to calculate and then fill up the arrays in javascript so if i just output it to a file then copy the file into a java script patch all that format time will be gone and i will only have to deal with the javascript runtime compiler or stack or heap or whatever they calling it nowadays.

so although VH is not inherently a file writer it certainly can be used to extract your values very quickly with some find and replace.

so recap if you open the .plist in a text editor there is a bunch of crap really messing up your data so open up your property list editor and save as text. that should get rid of all the binary mess you don't need as a file writer.

see pic for setting to extract the goods.

PreviewAttachmentSize
Picture 2.png
Picture 2.png32.57 KB