Cubemap Image Question

Started by
5 comments, last by Deception666 18 years, 7 months ago
I have been trying to find the answer to this problem for the last couple of days. Hopefully, someone out there can help me with my problem. I am using the ARB_texture_cube_map extension and the posx, negx, posz, and negz images seem to be flipped vertically when viewed. The posy and negy images seem fine. Here is the image output: Have I overlooked something? Do you have to align your images in a certain way for cubemaps? Thanks for the help.
Advertisement
what library are you using to load your images?
are they TGA?
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website
The images are JPEG. The library used to load the images are JPEGLIB. Since the images of a JPEG are flipped vertically, the JPEGReader from my ImageLibrary makes sure that the image is correctly positioned in the image buffer created by the ImageLibrary. I have tried this with BMPs and TGAs as well to come to only see the same thing.

Maybe I'm thinking of this wrong. In the OpenGL registry, it says that the coordinate system being used, if thought of from inside the cube, is LHS. This makes sense, but there is an explination that is bothering me. I've looked at the Nvidia and ATI sites on this, and they both show the same thing. I came to another site which presented something a bit different.

Hardware-accelerated Reflections - Ian Scott

He has two images that I cannot get my head around.




When I look at the top picture, I can see myself standing in the middle of the light blue front square and the entire box exclosing around me. But from his second picture, he is saying that the box is actually enclosing the other direction. Now, if I am the teapot facing the front, light blue square, the right square is actually my left. That doesn't seem right. Can anyone shed some light on this? Thanks.
Why do all the images have to flipped vertically? I haven't found an explination in the OpenGL registry as to why the images have to be flipped vertically. Almost all the examples I have found flip the images in this mannor. Is this done so that hardware can compute a reflected vector more efficiently?
u can also change your texture coordinates
I had a similar problem (almost identical) and i fixed it by changing the origin of the images, i dont know the code to do this exactly because im using DevIL and its just a simple API call.

you might want to just try out DevIL (just hack/slash it) to see if thats your problem: www.imagelib.org
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website
This picture makes it more clear as to why the images have to be flipped vertically. This image is from the MSDN library, and I am assuming this implementation is correct in both cases for OpenGL and DirectX. I believe I remember reading that the OpenGL implementation was adopted from the DirectX implementation. Either way, this image makes it clearer as to why the images must be flipped.



MSDN - Cubic Environment Mapping

This topic is closed to new replies.

Advertisement