#1
|
|||
|
|||
Getting data from a render texture
Hello,
I want to get the data from a depth texture. I use the following command to create the texture: Code:
depthtex = viz.addRenderTexture(format = viz.TEX_DEPTH, width = 8, height = 8) Greetings, Joran. |
#2
|
|||
|
|||
There is currently no built-in way to retrieve the data from a render texture. You could create a modifier plugin that attaches a post draw callback to the underlying osg::CameraNode object. From the callback you should be able to read the pixels from the texture into memory.
Do you need the data for real-time purposes (i.e. every frame)? If not, you can workaround the problem by rendering the depth texture to the screen and then capturing the screen to a file. |
#3
|
|||
|
|||
It is for real time processing. Is there any chance this functionality will be added in the future to Vizard?
Otherwise I will have to make that plugin. I am not looking forward to that. |
#4
|
|||
|
|||
I am revisiting this 'problem'. The version using a plugin did work (I need to recompile the plugin again). But now I saw the <multimedia:image>.saveToBuffer() method. It looks very useful. I still have:
Code:
depthtex = viz.addRenderTexture(format = viz.TEX_DEPTH, width = 8, height = 8) Code:
depthtex.saveToBuffer('<raw>') But this buffer then contains an 8 bit z-buffer. When I change my texture format to viz.TEX_DEPTH_32, I get the error message: Code:
error pixelFormat = 81a7 ** ERROR: Texture does not contain image data, cannot save to buffer Greetings, Joran. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
writing joystick position to a data file | Saz | Vizard | 3 | 12-17-2008 06:18 AM |
Translating a texture and its Alpha | shivanangel | Vizard | 5 | 12-02-2008 05:52 PM |
Randomly and Continuously Change Avatar's Face Texture | Karla | Vizard | 4 | 08-22-2008 01:14 PM |
tracking using quaternarion data | jfreeman | Vizard | 2 | 06-01-2005 09:48 AM |
how I can get my texture to appear exactly as is defined | mspusch | Vizard | 1 | 04-23-2005 01:12 PM |