Jump to content
  • Advertisement
Sign in to follow this  
absriram

Feedback From Shaders

This topic is 4956 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

Is there a way to get feedback from fragment shaders. I want to check the framebuffer for a fragment with a color different from the others. Is glReadPixels() the only way? I feel that it is very expensive in terms of the CPU power it takes to read the pixels back, especially if the framebuffer is big. Is there a way I could set a flag or something similar once I have encountered the different colored pixel and send a message back to the CPU? Or can i set the color of the top-left pixel according to my check results or do something like that? Thank you, Sriram

Share this post


Link to post
Share on other sites
Advertisement
I don't think there is anyway to access the frame buffer from inside the fraagment shader. You should remember that once you issue the draw commands you can only modify how it is drawn but you cannot stop or move back and forth in the middle of the graphics pipeline.

Instead of using the glReadPixels(), you probably can use the stencil buffer to catch that one particular value if you know it falls in a particular range. Also you cannot compare two pixels that are generated during the same rendering pass.

Hope this helps!

Share this post


Link to post
Share on other sites
I definitely will know the range of the different colored pixel, even better, i am looking for a particular color. So, how should I use the stencil buffer?

Thanks

Sriram.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!