programming

iniTreeStructure (iniTree with vertices output)

LukeNeo's picture

Some days ago I posted iniTree plugin, that allow to draw recursive ternary trees. Gtoledo suggested to rewrite the plugin as a provider. Asking the community what is the best way to output a structure from a QCplugin, I used the method suggested by dust, and the implemented iniTreeStructure, which is a iniTree plugin witch outputs vertices positions.

Inputs:

  • numDiv (1-3): how many branches will have your tree.
  • growDelay: how much time the tree branches will spend in growing/shrinking.
  • aperture: tree aperture.
  • add/remove level: add/remove tree level.

Outputs:

  • vertices: tree vertices positions. They are ordered so as to be rendered using GL_LINES, so if you attach this output to GL line structure and use line type Line segments, the output will be right.

xCode error on compilation

cybero's picture

I've been trying to get some OpenGL and GLSL stuff done as executables in xCode, whilst porting GLSL stuff back to QC's GLSL level of support.

When trying to compile Shader Maker from source [it's executable fails to stay loaded in OS X 10.7.x] I got the following error /bin/sh failed with exit code 22

Any ideas as to why that is happening and what can be done to rectify the problem? Just can't see the wood for the trees on this at present :-)

How to output a vertices structure from a custom plugin (with code)

LukeNeo's picture

Hi to all, I'm trying to extend my iniTree plugin with a custom plugin that outputs a structure with vertices position every frame, as suggested by gToledo. To try this kind of output I tried to modify my drawTest plugin so instead of render vertices it outputs vertices position.. but I cannot make it work properly. This is my approach:

  • vertices positions are stored in a float vector
float   v[VSIZE][3];
  • vertices positions are copied every frame in a NSArray (output_struct) made of NSArrays (currVertex) in this way:
   for(int x=0;x<numV;x++){
      [currVertex removeAllObjects];
      [currVertex addObject:[NSNumber numberWithFloat:v[x][0]]];
      [currVertex addObject:[NSNumber numberWithFloat:v[x][1]]];
      [currVertex addObject:[NSNumber numberWithFloat:v[x][2]]];
      [currVertex addObject:[NSNumber numberWithFloat:1.0]];
      [outputVertices addObject:currVertex];
   }
 
      //create output structure
   self.output_struct = [NSArray arrayWithArray:outputVertices];

It seems to output the same kind of result of a mesh importer (you can see it in outputs img), but for some reason my plugin output doesn't work. In the zip you can find xcode project, a composition example and a dae mesh to test it.

I think I don't build the structure in the correct way. For example, in the Apple developer guide I read that we must use NSDictionary to output a structure, but I can't use it in the correct way. Anyone knows the correct way to output a structure from a custom plugin?

My first Plug-in problem! Blending modes

idlefon's picture

I'm making my first plug-in. It's a simple consumer plug in that renders filled ellipses.

I have a problem/question at the moment:

How to implement different0 blending modes in it (As same as the KinemeGL render patches )?

Using GLUT in QC custom plugin

LukeNeo's picture

Hi, is it possible to use GLUT library inside a custom QC plugin? I tried to do that in this way:
* add GLUT framework to my project
* add

#import <OpenGL/OpenGL.h>
#import <OpenGL/gl.h>
#import <OpenGL/glu.h>

in my plugin.h

now, if in the execute method I try to make a simple sphere with this simple code..

- (BOOL) execute:(id<QCPlugInContext>)context atTime:(NSTimeInterval)time withArguments:(NSDictionary*)arguments
{
 
[...]
 
GLUquadricObj *quadratic;
quadratic=gluNewQuadric();
gluQuadricNormals(quadratic, GLU_SMOOTH);
gluQuadricTexture(quadratic, GL_TRUE);
gluSphere(quadratic,10.3f,32,32);
 
[...]
 
}

..nothing happens. Where I am wrong?

Thank you, Luke