Slicing images?

This might seem like an odd question and I have a few theories on how to do it, but not sure what’s best.

If I take an OpenGL scene and plop a sphere with a diametre of 4.0 into it I want to divide the sphere into 4 quadrants (tiles of 1.0x1.0x1.0 each essentially) and create 4 bitmaps using glReadPixels of the sliced sphere. I want each bitmap to contain only the pixels rendered that fit in each quadrant. Anyone follow this so far?

So I thought of two ways to do this. First, I could just alter the clipping planes to do it for me but I think these are oriented to the viewing angle, not the scene. Second I thought about creating a plane and shifting it around, using it to divide the image (make the plane black so it cuts off the solid sphere). I don’t think the plane idea will work because when it comes to clipping the sphere with the plane in front of object (between the viewer and the object) you won’t see anything.

Anyone know what I’m talking about or how I might achieve this? Thanks.


Flame me if I’m missing the point, but can’t you just read the whole sphere with glReadPixels() and then chop the resulting bitmap into four equal parts?

Hi Tom,

Yes, slicing the image in 2D is simple but what I’m trying to achieve is a slice in 3D, sort of like doing those exploded views you see of engines where there’s a cutaway of the model and you can see the inside. Well, something like that. Just not sure how to do it.