We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › OpenGL cones and masking
Page Index Toggle Pages: 1
OpenGL cones and masking (Read 300 times)
OpenGL cones and masking
Aug 20th, 2008, 4:35am
 
I want to make a number of cones (as a hacky way of doing a voronoi tiling), and then mask what we see with an image. Here's the snippit of code I'm using, from my draw routine. col[i] is the color for the ith cone and outline is an image file used as the mask.

I'm using size(640, 480, OPENGL); as my render mode.



 // draw the 'cones'
 pushMatrix();
 // -10 means the cones are below the surface
 // (so we can draw on top of them later)
 translate(0,0,-10);
 for (int i = 0; i < numpop; i++) {

   noStroke();
   
   r=brightness(col[i]);
   b=1-brightness(col[i]);
   g=0;
   
   fill(r,g,b);
   
   cone((xx[i]),(yy[i]),600.0,10.0);

 }
 popMatrix();

 outline.mask(outline);    
 image(outline,0,0);



Now, when I have the cones translated by (0,0,-10), the mask shows up, but all the cones are a uniform solid blue. When I use (0,0,0) translation the cones appear in the proper colours, but the mask vanishes.

Any ideas?
Page Index Toggle Pages: 1