[PD] developing pd-gem externals

IOhannes zmölnig zmoelnig at iem.at
Fri Apr 8 16:29:30 CEST 2011


ola

On 04/08/2011 04:09 PM, Juliana Vizzotto wrote:
> for instance. We download the svn development sources...
> Please, it would be great to have the source of cube, for instance, or any

there is no real documentation on how to do that.

if you want to do it in C++, you should go for the sources.
basically, each Gem-object has it's own file (living in different 
directories, depending on their "type").
e.g. the code for [cube] can be found in Gem/src/Geos/cube.cpp (.h).

to start a new object, it's probably easiest to just copy an existing 
object:
- copy
  $ cp Geos/cube.cpp Geos/supercube.cpp
  $ cp Geos/cube.h Geos/supercube.h
- rename the object's internals
  $ sed -e 's|cube|supercube|g' -i Geos/supercube.cpp
  $ sed -e 's|cube|supercube|g' -i Geos/supercube.h
- recompile
  $ make
- use
  [supercube]

the above is a bit simplistic, you will probably want to do the 
search&replace manually, rather than trusting sed;
obviously, you also might want to add some code before running make.



however, there you don't necessarily need to write C++ code.
for simple things, Gem wraps all the openGL commands into objects. e.g. 
you can use [GEMglVertex3f] rather than glVertex3f()

for more complex things, you could use one of the scripting languages 
supported by Pd, e.g. lua (frank barknecht has done some nice things 
with Gem & lua; there might be examples in the web...)

and of course there is GridFlow's openGL injector, that allows you to 
write openGL commands as messages, and inject them into Gem.
something like (it's surely not working, but you should get the idea):

[gemhead]
|
[Vertex 3 4 5, Color 1 0 0(
|
[gf.gl]


gfasdrm
IOhannes



More information about the Pd-list mailing list