PDA

View Full Version : Accessing a portion of an uploaded texture



pleopard
01-20-2004, 01:49 PM
Is there any way I can divide up a texture that has already been uploaded and my data deleted? What I mean is that if I have the integer texture name of a texture I want to divide up and I no longer have access to the image data (or pointer to the image data), is there a way that I can select portions of the texture in a manner similar to glTexSubImage2D?

The problem I have is that I have a texture manager that loads just about any type of image file but discards the image data once the texture is uploaded. I cannot get the pointer to the image data needed by glTexSubImage2D but I need to divy up an existing texture in the same manner.

Any thoughts?

sqrt[-1]
01-20-2004, 02:05 PM
Re-downloading the image with glGetTexImage then using the data in glTexSubImage2D is the only technique that comes to my mind. (Unless you want to render the texture to a p-buffer then do a sub-load from frame)

bunny
01-20-2004, 02:34 PM
If you need access to the image data once you've uploaded the texture, surely the obvious solution is to change the texture manager to allow you to keep track of the image data.

pleopard
01-20-2004, 03:34 PM
Thx sqrt, i'll give that a shot.

Dodger
01-20-2004, 06:12 PM
here's another idea:
render the texture in a screen aligned quad to the frame buffer or to a pbuffer, then glCopyTexSubImage from the framebuffer into another texture.
Of course, the framebuffer approach is limited by the size of your viewport, and the pbuffer approach by the slight pain of setting up a pbuffer and the cost of context switching (which is still very high in my opinion)