Jump to content
  • Advertisement
Sign in to follow this  
Icebraker

Write-access to texture in shader?

This topic is 4330 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
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

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!