How Can I write to application values from GLSL Shader?

Started by
3 comments, last by nadro 16 years, 11 months ago
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?
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.
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.
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?
OK. I use standard OpenGL blending for multipass:) Thanks all:)

This topic is closed to new replies.

Advertisement