Hi! I want to get the pixels of 6 framebuffer textures, and load them to a cubemap texture.
So I use the copyToImage function and then I load the 6 images to my cubemap like this :
images.clear();
for (unsigned int m = 0; m < 6; m++) {
math::Vec3f target = reflectView.getPosition() + dirs[m];
reflectView.lookAt(target.x, target.y, target.z);
std::vector<Entity*> visibleReflEntities = World::getEntitiesInRect(reflectView.getViewVolume(), expression);
std::vector<Entity*> copy;
for (unsigned int j = 0; j < visibleReflEntities.size(); j++) {
if (visibleReflEntities[j]->getRootEntity() != reflectEntity) {
copy.push_back(visibleReflEntities[j]);
}
}
pplls[m]->loadEntitiesOnComponent(copy);
pplls[m]->setView(reflectView);
pplls[m]->clear();
pplls[m]->drawNextFrame();
images.push_back(pplls[m]->getFrameBufferTexture().copyToImage());
}
int width = view.getSize().x;
int height = view.getSize().y;
cubeMapTex.createCubeMap(width, height, images);
When I display image pixels it seems to be good but when I want to pass the image pixels to the cubemaps textures, those textures are empty.
I used gDEBUgger to see what's happening and, it displays the pointer to image's pixels in the glTexImage2D function, but it doesn't fill the texture because the texture is empty when I display it in the gDEBugger view.
It seems there is a problem with the getPixelsPtr() function when I copy FBO texture to image.
Isn't there another way to do to copy my FBO textures to my cube map ? It doesn't seems to be a good way of doing this.