Jump to content
  • Advertisement
Sign in to follow this  
nadro

OpenGL How Can I write to application values from GLSL Shader?

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

Hi. For Graphic Render I use Irrlicht in OpenGL and GLSL support. How Can I write values from pixel shader to my application buffor or outside file. I need use 2 shaders to calculating more than 3 per pixel lighting. I planning calculate gl_FragColor in first shader, next write this value to application and in second shader download this value and using in calculating colour example: OutColor = curColor + prevglfragcolor; gl_FragColor = OutColor; How Can I do it?

Share this post


Link to post
Share on other sites
Advertisement
You can't, as far as I know. You would have to render to a texture, then extract the values you need from the texture.

ADDED: I just read your post closer, and realized that you didn't actually want to access the data in your program, only in the second shader program.... you would render to a texture and utilize that texture in your next pass.

Share this post


Link to post
Share on other sites
Quote:

You can't, as far as I know.

This is correct; uniforms and constants and their counterparts in other languages are are one-way. As you said, the only way to preserve data for later access, by another shader program or the CPU, is to render to a texture.

Share this post


Link to post
Share on other sites
OK. I have one pass in texture, I add shader to node and have two pass in texture2. How Can I split this "screens/textures"? Can I please source code?

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!