# Cube mapping confusion

GL_ARB_texture_cube_map extension documentation (http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_cube_map.txt)
gives the following formula to compute s and t coordinates for the selected face

s = ( sc/|ma| + 1 ) / 2
t = ( tc/|ma| + 1 ) / 2

(See the table in the doc. for the sc,tc and ma. Make a text search for the above lines )

Now, if I understand the table and formula correctly if I have <0,0.5,1> as input:
major axis is +z (so positive z face texture will be used )
sc = +rx = 0
tc = -ry = -0.5
ma = 1

s = 0.5
t = 0.25

So, even though my vector looks above the x-z plane (it has positive y value) it returns me a texel from below the middle line of the face. Try with <0,-0.5,1> and you get 0.5 , 0.75. It is as if the image is mapped inversely.

This is what I experience in the application I am working on now. I am making dynamic cube mapping and it works only if I generate cube faces with a camera which has the up vector towards the ground instead of sky.

The problem is none of the articles I saw mentions this. All cube map images I saw are (you know those unfolded ones) are with up=+Y.

So it seems like I am missing something. Any ideas?

I have another question about cubemapping too… The doc says cubemaps fits Direct3D ones to be compatible… but i’m sampling cube from inside in D3D and from outside the OGL ones… Are the OGL cubemaps fetched using rays coming from outside or from inside??? thx

Are the OGL cubemaps fetched using rays coming from outside or from inside
I’m pretty sure it’s inside. But don’t forget; the image faces themselves are still uploaded in the OpenGL-standard way, not the D3D one.