GLSL : Graphic card bug ? QC bug ? Bad code ?

benoitlahoz's picture

Hi !

I've been fascinated for months with toneburst CI implementation of Light Scattering, from GPU Gems. So I decided to try to make a GLSL Shader with it. In fact, while googling I found some simple GLSL code coming directly from GPU Gems (

But, it is very buggy, and it looks like a graphic card bug, or maybe I'm not dealing with the texture properly, or... could it be a QC bug ? (I'm on 10.8)

I would be extremely grateful for any advice on this :-)



glPolygonMode wireframe quads

bonerton's picture

Hey, there used to be a Kineme patch to render wireframes in quad mode (Kineme GL Grid Renderer), but it seems to have disappeared recently? Is there a way to do this with a glsl shader?

iniTree - draw your own recursion tree

LukeNeo's picture

Hello there, I just want to share with you a simple that draws a ternary tree. The algorithm is very simple and uses recursion. Here is what it does in pseudocode (for n-ary tree):

  1. main{
  2. max_levels = 10 //the max num of levels
  3. tree(initLenght, 1);
  4. }
  6. tree(length, level){
  7. if(level<max_levels){ //is the end of the recursion?
  8. n = 3 //it is a ternary tree
  9. for(x=0; x<n; <++){
  10. pushMatrix()
  11. rotate ((360 / n)*x) along y axis
  12. rotate (aperture) along z axis
  13. drawLine(0,0,0, 0,length,0) //from 0,0,0 to 0,length,0
  14. translate(0,length,0)
  15. tree(lenght/2, level+1) //recursive call
  16. popMatrix()
  17. }
  18. }
  19. }

As you can see, I used glRotate/glTranslate and glBegin(GL_LINES)/glEnd() calls, in old OpenGL style. Maybe this is the reason why with more than 8/9 levels I don't obtain good performance. Using vbo will result in better performance, but I'm still not sure about how to do that.

It is a very simple plugin, but if used in audio-reaction compositions I think it can produce interesting results. So let me know if someone use it in some cool way! :)

Download(plugin and example composition)

Rendering huge amount of vertices (VBO)

LukeNeo's picture

Hi to all, I'm developing a plugin that allows you to render a set of vertices randomly distributed in space. I’d like to draw a huge amount of vertices at the same time: to do this I tried to use OpenGL Vertex Buffer Object (VBO), because I read that it allows vertex array data to be stored in high-performance graphics memory on the server side and promotes efficient data transfer.

This is my approach:
* Generate a new buffer object with glGenBuffersARB().
* Bind the buffer object with glBindBufferARB().
* Copy vertex data to the buffer object with glBufferDataARB().

so in my startExecution plugin function I wrote:

  1. - (BOOL) startExecution:(id<QCPlugInContext>)context
  2. {
  3. CGLContextObj cgl_ctx = [context CGLContextObj];
  5. glGenBuffersARB(1, &VBUFFERNAME);
  7. //vcArray is defined as float vcArray[numV*3]
  8. glBufferDataARB(GL_ARRAY_BUFFER, sizeof(vcArray), vcArray, GL_DYNAMIC_DRAW_ARB);
  9. glVertexPointer(3, GL_FLOAT, 0, 0);
  11. return YES;
  12. }

and in my execute plugin function I do this:
* Update vertices in vcArray using glBufferSubDataARB()
* Draw them using glDrawArrays()

  1. - (BOOL) execute:(id<QCPlugInContext>)context atTime:(NSTimeInterval)time withArguments:(NSDictionary*)arguments
  2. {
  3. CGLContextObj cgl_ctx = [context CGLContextObj];
  5. //update vcArray vertices
  6. updateVertices();
  8. glEnableClientState(GL_VERTEX_ARRAY);
  10. {
  11. glDrawArrays(GL_LINE_STRIP, 0, numV*3);
  12. [self calcVertices];
  13. glBufferSubDataARB(GL_ARRAY_BUFFER, 0, sizeof(vcArray), vcArray);
  14. }
  15. glDisableClientState(GL_VERTEX_ARRAY);
  16. glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
  18. return YES;
  19. }

..the problem is that I can’t get noticeably performance improvements than the immediate mode rendering: they are the same! For example, using VBO I got 60 FPS with 2.500 vetices, 40 FPS with 5000 verices, and 10 FPS with 20.000 vertices.. and that are the same performance I got in immediate mode, using simple code like these:

  1. glBegin(GL_LINE_STRIP);
  2. for(x = 0; x<numV; x++){
  3. glVertex3f(v[x][0], v[x][1], v[x][2]);
  4. }
  5. glEnd(); I missing something in the VBO approach? Why I can’t get performance improvements?

Thank you, Luke

GTTextureTransform ("skanky" sdk patch): Release

gtoledo3's picture

This is skanky Quartz Composer plugin, environment macro, that transforms the GL Texture matrix.

GTTextureTransform from George Toledo on Vimeo., this means that in this environment you can do things like zoom, offset, or rotate texture through OpenGL function.

For example, one can rotate the texture on a sphere while keeping vertex positions the same, or one can zoom image on a sprite without using core image, etc.