Jump to content
  • Advertisement
Sign in to follow this  
MARS_999

GLSL gl_FragColor question

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

I know that you're supposed to code small shaders, but on 7800 series cards isn't the program length unlimited? That isn't the main question but if I have one shader and it calculates the final color and is sent to gl_FragColor and if I have another shader after that shader does the color from the first shader stay and allow me to pick up and continue modifiying the primary color? Or when the first shader is done I lose that information and have to start over? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Well you can only bind one shader program at a time, which is exactly one vertex and one fragment shader. Therefore any geometry drawn is only sent to one vertex and one fragment shader. The pipe line is linear (afaik), so theres no way for fragment data to go back a step and pass through another shader program. The only way to achieve this is to use FBOs and do a multipass render. I can't think of a good reason why one shouldn't be able to access the fragment you are about to overwrite. The screen coordinates have already been calculated by the time the fragment shader gets called, and in an FBO system the draw buffer is stored in the same memory as textures, so in theory could be accessed using a samplerRECT!

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!