How Can I write to application values from GLSL Shader?
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?
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement