PDA

View Full Version : How to draw Cube Map's each Face alone?



zhq424
09-18-2003, 05:00 PM
Cube map texture has six sub-texture corresponding to cube's six face. And I render the scene six times and get the dynamic CubeMap texture. But I do not know whether the result of drawing is right, So I want to draw the CubeMap's six faces in a six rectangles. my question is How to display it?

rgpc
09-18-2003, 05:47 PM
I can't say I've done this but I remember someone stated that you can just treat your cube map like a 3D texture.

So...

glTexCoord3f(0.0f, 0.0f, 1.0f)
glTexCoord3f(1.0f, 0.0f, 1.0f)
glTexCoord3f(1.0f, 1.0f, 1.0f)
glTexCoord3f(0.0f, 1.0f, 1.0f)

will give you one face (right face?) etc.

Just use that and render onto 6 quads (I believe this is correct, I haven't tried it myself).

Korval
09-18-2003, 05:59 PM
my question is How to display it?

Well, if performance isn't a question (and this is a debugging tool, so it shouldn't be), then you could just copy each face to another texture, and render those as quads.

Or, you could do as 'rgpc' suggests; that ought to work too.

zhq424
09-18-2003, 07:48 PM
Thanks rgpc and korval,

If I call glTexCoord3f(1.0f, 1.0f, 1.0f), which cubemap face will I get? I remeber that Hardware will chose the face by the max component of (s, t, r).
In this case, What's the rules?

[This message has been edited by zhq424 (edited 09-18-2003).]

Mazy
09-18-2003, 10:30 PM
If your not going to use the same texcall for all vertices in the triangle/quad it really doenst matter since its going to be interpolated with the other vertices texcoords pretty quick and then you have your highest value on some value ( well you can certainly make it interpolate the same on all 3 values and get unpredictable results)