PDA

View Full Version : Using Textures for Non-Visual Data?



cpsmusic
01-16-2006, 03:14 PM
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

memfr0b
01-17-2006, 04:56 AM
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.

dmy
01-18-2006, 05:29 AM
what are you trying to do in the first place ?

< :) >
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...
</ :) >

cpsmusic
01-19-2006, 08:08 AM
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 ;)

Cheers,

Chris