I’m trying to use cube mapping for reflective surfaces. I’m already drawing a skybox with 6 textures mapped to a cube, so I thought it would be easy enough to just glBindTexture(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, myTexture), etc, for all the different faces, since they’ve already been loaded. I’m using GLUX for loading extensions. However, when I bind the 6 textures this way, nothing happens. The GL_REFLECTION texture generation is working, but the textures aren’t. Do I need to load them again using glTexture2D? Shouldn’t I be able to share these textures?
glTexSubImage2D + GENERATE_MIPPMAP_SGIS
I’m sorry, I’m not sure what that means.
Here’s what I understand:
glTexSubImage2D: Allows me to load a new texture over part of an old texture.
GENERATE_MIPMAP_SGIS: Allows for automatic mipmap generation.
How do I put those together to allow six already-loaded 2D textures to do double-duty as a cube map? It’s not clear to me from your response.
Whoups, didn’t read your post as carefully as I should have
The problem is that cubemap takes place over 1D/2D texturing ops.
If you want to share textures on one obj you have to resort to 2pass rendering or fragment program.
2 paas tech:
enable 2D tex
Hmm, I’m still not sure that helps me. Let me try to refine my question:
Right now, I am drawing a skybox (a cube with 6 separate textures) so I’m already loading 6 2D textures. What I’d like to do is have objects in my scene reflect that skybox. This means the 6 skybox textures need to become 1 cube map. I’d like to just be able to reuse the textures I’ve already loaded, as opposed to loading them again with glTexture2D into the cubemap targets. How can I do that?
I doub’t you can do that, maybe only with fragment program, but the performance penalty will be A LOT higher than if you have seperate cubemap & 6 2d textures. I myself use 6-2D+cube in my programs.
So, just to be clear, I have to load 6 images into GL, then load those same 6 images again into GL to get it to work as both 2D textures and cubemaps.