   Can I accomplish this using Shaders or is that overkill?
  Hi guys,I'm making a simple volume renderer and I got a simple sphere to display. The next piece of functionality I need is to be able to cut shapes out of it, so that I can look at the inside.One brute force way of doing it is for each pixel inside the 3d texture, set the alpha value = 0 if the pixel lies within a cut-out shape. But this is extremely slow since it's all done in software.I'm hoping that there's someway I can "attach" a function to somewhere inside the OpenGL pipeline. So that before OpenGL draws the pixel onto the color and depth buffers, it will ask me whether I want to draw that pixel, and then I can calculate whether the pixel lies inside a cutout shape, then respond "yes. draw that pixel" or "no. that pixel is supposed to be cut."Oh, and if there's a simpler way of doing this please tell me. I would like to avoid using shaders if possible.Thanks for your help  -Patrick   
  there are several ways to accomplish this, like stencil csg. it depends on the complexity of your geometry that you want to use for cutting. is it just one or more planes? is it convex?...   ;  Shaders are, by definition, a place to attach your own code to the graphics pipeline.In a fragment shader, you can provide an early exit if some criteria (that you define) is met. In D3D HLSL, there is an intrinsic function called "clip" which discards the current fragment so it doesn't get drawn. While I don't remember the exact equivalent in GLSL or CG, I know that they can also do this.   ;  For GLSL it is "discard" which discards the current pixel. Although I can't remember the CG one too (never worked with CG too much).   