Jump to content
  • Advertisement
Sign in to follow this  
Deception666

Cubemap Image Question

This topic is 4650 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!