I am attempting to implement a Skybox into my C++ OpenGL project, and I want to use 6 x preloaded GL_TEXTURE_2D's retrieved from my TextureLibrary which loads all textures into the application as GL_TEXTURE_2D.
The issue I am running into is that I cannot use a GL_TEXTURE_2D for each face of a GL_TEXTURE_CUBE_MAP (that I know of). I have tried a variety of different approaches, however it appears that I cannot refer to or copy the image data from a GL_TEXTURE_2D to a GL_TEXTURE_CUBE_MAP face such as GL_TEXTURE_CUBE_MAP_POSITIVE_X on the GPU side.
To get this working currently the texture is being loaded on the CPU into my TextureLibrary as a GL_TEXTURE_2D, then it is being loaded again on the CPU in my Skybox class as a target of a GL_CUBE_MAP face, just as a temporary and inefficient way around this issue.
Is there any way to have the face of a GL_CUBE_MAP refer to or copy the data of a GL_TEXTURE_2D?
I plan to utilise these textures as GL_TEXTURE_2D's throughout the application in the future so I want to have them loaded on the CPU side once into my TextureLibrary, and only when they are used by a Skybox, the data is referenced or copied on the GPU side into a GL_TEXTURE_CUBE_MAP.
Alternatively, I could scrap the idea of using a GL_TEXTURE_CUBE_MAP, and pass my skybox shader 6 x Sampler2D's; however, I would like to know if there is any way I can do this per the above - OR any other ideas.
You can try this:
Prerequisites:
Reference:
There is an alternative solution, follow the links for more information:
If everything else fails:
GL_PIXEL_PACK_BUFFERtargetglGetTexImageGL_PIXEL_UNPACK_BUFFERtargetNo client memory involved, all on the GPU side.