SMH
SMH

Reputation: 1316

Drawing the intersection between glut objects in C

I am trying to draw the intersection between two glut objects, I managed to draw each object separately but I was wondering if I can draw only the intersection between the two objects? My Code below draws a solid cube and sphere:

/* draw a cube */
        glTranslatef( 0.0, 0.0, 30.0 );
        glutSolidSphere(30,12,6);

        /* draw a wire sphere */
        glTranslatef( 0.0, 0.0, 30.0 );
        glutSolidCube(30);

Upvotes: 1

Views: 445

Answers (1)

datenwolf
datenwolf

Reputation: 162269

Since OpenGL is not a scene graph (i.e. it doesn't maintain some kind of scene representation) but only draws simple primitives (points, line, triangles), one at a time, this is not immediately possible. There are methods to do this in image space, using multipass stencil buffer trickery. Here's a nice explanation: ftp://ftp.sgi.com/opengl/contrib/blythe/advanced99/notes/node22.html

Upvotes: 1

Related Questions