Cubemap upside down.

Started by
6 comments, last by Yours3!f 12 years, 11 months ago
[attachment=2607:Untitled.jpg]

Not sure if you can tell form the image but the horizontal faces of my cube map are upside down. However, the up and down faces are correct. How can I fix this without flipping the image files upside down?
Advertisement
Not sure that you can. Image files are generally stored with the origin at the top left of the image, where as OpenGL treats the origin as the bottom left of the image.
There is 2 ways. Fix the image or fix your texcoords.
The cubemaps in GL follow the Direct3D convention of left-handed. This means that the +z and -z faces are switched. I'm not sure if that is your problem.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

There is 2 ways. Fix the image or fix your texcoords.
The cubemaps in GL follow the Direct3D convention of left-handed. This means that the +z and -z faces are switched. I'm not sure if that is your problem.


GL cube mapping is not the same as DirectX and I should know since I am converting my rendering pipeline from directx to opengl.
TGAs? Check byte 17 of the header, if bit 0x20 is set you need to flip it when loading.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.


TGAs? Check byte 17 of the header, if bit 0x20 is set you need to flip it when loading.


No, PNG but if I flip all images the top and bottom won't line up with the sides.
[color="#1C2837"]GL cube mapping is not the same as DirectX and I should know since I am converting my rendering pipeline from directx to opengl. [/quote]
[color="#1C2837"]Huh? The coordinates for cube mapping are DX style as V-Man said so I don't know what you mean in your above statement by not being the same. Did you try loading them into opposite coordinates? Pretty sure this is your issue.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

first I'd suggest playing around with the image files flipping them etc., if you get them right then you can write down which was flipped and set the texcoords accordingly. For me I think I had to flip all of them upside down, but I didn't bother dealing with the texcoords...

This topic is closed to new replies.

Advertisement