Write-access to texture in shader?
Hello,
I have implemented a shader which gets a sampler2DShadow texture as a uniform input. Is there a command which allows me to write to the texture in the shader (i. e. explicitly set the values of the texture) ?
Thx a lot
Icebraker
No, there is no such command because shaders are so embarassingly parallel. The only writable things are the interpolators (POSITION, NORMAL, COLOR etc semantics) and the target framebuffer. There isn't even a command to explicitly set the color of pixels in the framebuffer. The best you can do is set up a render to texture and for each pixel in the shadow texture you do some processing and output the pixel into the target texture.
Thx for your fast response.
Which commands do I need to render into a texture instead of rendering to the frambuffer? Could you give a little example how to write to a texture in the shader?
thx
Which commands do I need to render into a texture instead of rendering to the frambuffer? Could you give a little example how to write to a texture in the shader?
thx
there are several possibilities...
- render to framebuffer - like you do now and use glCopyTexImage to copy to texture
- use pixelbuffer (don't do it)
- use framebuffer objects - best solution for performance and the future.
- render to framebuffer - like you do now and use glCopyTexImage to copy to texture
- use pixelbuffer (don't do it)
- use framebuffer objects - best solution for performance and the future.
NVidia has an awesome PDF presentation about FrameBuffer Objects. There are some code examples in there too.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement