Sign in to follow this  
Icebraker

Write-access to texture in shader?

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this