[QUOTE=VelociChicken;1245403]Hello, is it possible to compress a texture that’s already in vram?
I’m creating textures using fractals so I have to render to them uncompressed, I then load them back into CPU memory, and then send them over again compressed.
Something like this:-
glGetTexImage(GL_TEXTURE_2D, 0, colour_format, colour_type, image);
glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB, width, height, 0, colour_format, colour_type, image);
It seems like wasteful bandwidth to me, is there any other way of doing this without the transfer? I’m guessing not, but I’d like to be certain.
Thanks again,
Dave.[/QUOTE]
OK I got a great reply from the comp.graphics.api.opengl newsgroup:-
GLuint buf;
glGenBuffers(1, &buf);
glBindBuffer(GL_PIXEL_PACK_BUFFER, buf);
glBufferData(GL_PIXEL_PACK_BUFFER, width * height * bytes_per_pixel,
(const GLvoid*)0, GL_STREAM_COPY);
glGetTexImage(GL_TEXTURE_2D, 0, colour_format, colour_type, (GLvoid*)0);
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buf);
glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB, width, height, 0, colour_format, colour_type, (const GLvoid*)0);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);