viewing volume problem


I am trying to make a program that uses projective texturing. I works quite well, but there is still one problem. I would like to visualize the vieuwing volume of the projector. Can this be done by transforming a wirecube and how do you do this?

There are various ways to do that.
You could extract the plane equations of the 6 frustum planes from the projection matrix, then intersect always 3 planes with each other to get the 8 points of the frustum in camera space.
Another option would be to define a cube in clipping space that fills the space -1 < x < 1, -1 < y < 1, -1 < z < 1 and then transform the cube back to camera space by using the inverse projection matrix (or possibly some compound matrix that contains the projection matrix, depending on what coordinate system you need).

forgive me my ignorance but what do you mean by clipping space? I only know object, world or cameraspace.

I mean post-projection space, or clip coordinates.
To tell you the truth, I haven’t thought through the second option thoroughly, so your best bet is to simply extract the frustum planes from the projection matrix, of which I definitely know that it works.

The second option might require some more calculations that I haven’t thought of. I’m not really sure, but I think you have to divide by w after back-projecting the cube to camera space. I might be wrong though