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

Started by
2 comments, last by V-man 15 years, 5 months ago
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...
Advertisement
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!
Hey Jezham, been awhile! Yeah, I am not sure what I am going to do as of now. It's been put on the back burner for awhile as I work on a few other headaches first.
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);

http://www.opengl.org/wiki/index.php/OpenGL_extensions#Framebuffer_related_extensions
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement