detecting if within a 3D model

Hi

I have an object, a complex object at that, (this has nothing to do with display etc so no probs with effiecency), basically i need to produce a 3D binary matrix, where a 1 indicates the object (ie on surface or inside the object) and a 0 indicates not on/inside.
Question is how can i go about producing this matrix from an opengl model? Which method can i use to enable me to do this?

I think i have an idea on how to do this to form a matrix of the skin(so to speak) of the model, but then how can i do it for the body of the model?

Maybe a combination of gluproject/unproject and the depth buffer. Find the near and far planes of polys at that scren x,y to determine if you are within your model.