Using Textures for Non-Visual Data?

Hi,

I’d like to use a texture to store some non-visual data within a scene.

Firstly, is it possible to apply a texture to a polygon but make it invisible?

Secondly, is it possible to read the invisible texture data back from the GPU once it’s been uploaded?

I realise that what I’m trying to do can be done by creating a separate data structure within the app. and using that, however I thought using textures might be more efficient. Just wondering if it’s possible.

Cheers,

Chris

Originally posted by cpsmusic:

I’d like to use a texture to store some non-visual data within a scene.

Certainly possibly, though depending on your data you might need floating point textures.


Firstly, is it possible to apply a texture to a polygon but make it invisible?

Sure, with texture_env_combine or pixel shaders, you can configure the pipeline such that the texture is simply not used. But that seems rather useless. If you don’t use the texture, why apply it in the first place?


Secondly, is it possible to read the invisible texture data back from the GPU once it’s been uploaded?

With Frame Buffer Objects or Pixel Buffer Objects, easily. Without you’d first have to draw the texture to the framebuffer and then read it back via glReadPixels.


I realise that what I’m trying to do can be done by creating a separate data structure within the app. and using that, however I thought using textures might be more efficient. Just wondering if it’s possible.

If i understand you correctly this sounds like a stupid idea. If you don’t need/touch the data on the gpu, how can “upload data, download data unchanged, use data” be any more efficient than simply skipping the first two steps? You’d just be wasting texture memory and upload/download bandwidth.

what are you trying to do in the first place ?

< :slight_smile: >
my wild guess is that it seems like you’re trying to extend the “color-ID-picking” approach (rendering primitives with a certain color, reading back the color below a point, and using it as some form of indexing in some database) with something that keeps not only the index, but also the indexed data on the GPU…
no, it cannot be like this…
</ :slight_smile: >

Hi Guys,

Thanks for the advice. Sorry, but I can’t say what I’m trying to do, but trust me, it’s not stupid :wink:

Cheers,

Chris