Sign in to follow this  

Is there anyway to copy images from one 3D texture to another?

Recommended Posts

Is there anything like memcpy() for copying a 3D texture slice to another 3D texture slice? What I have is a mapeditor that has a texture array that holds however many textures the user puts in the texture directory. Now I only want to access at the most 16 at a time. So I thought of creating a second 3D texture that holds only 16 textures and copying over the selected textures...

Share this post

Link to post
Share on other sites
Hi MARS_999

I've been reading about 3D textures recently, they are quite cool indeed.
But for what you need I can only suggest that you keep a copy in system memory and update it accordingly (quicker than disk i/o for all slices) - then glDeleteTextures() and recreate again with glTexImage3D()

I guess you realize this will effect your current map edits :)

Then again, perhaps there is another way, similar to VBOs? In which case consider my reply as just a bump!

Share this post

Link to post
Share on other sites
Yes, it should be possible with GL_EXT_framebuffer_blit and GL_EXT_framebuffer_object although I have never tried it.
You would bind one FBO with
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fboID1);
and another FBO with
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fboID2);

and then blit
glBlitFramebufferEXT(int srcX0, int srcY0, int srcX1, int srcY1,
int dstX0, int dstY0, int dstX1, int dstY1,
bitfield mask, enum filter);

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this