Timeline for Sharing calculation result between shader programs in OpenGL
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 5, 2016 at 17:38 | comment | added | russ | There's a few options. Render-to-texture is probably the most straightforward but also kind of wasteful unless you need the results of your calculations in screen-space (like in deferred rendering), since you're rasterizing geometry before you can do any calculation. There's transform feedback, where you pull the output of a vertex or geometry shader before it hits the rasterizer and write it back to a buffer instead, might be good for the use case you mentioned but I haven't tried it myself. Otherwise compute shaders are the way to go, they're not that scary once you get used to them ;-) | |
Aug 2, 2016 at 6:37 | vote | accept | BPiek | ||
Aug 2, 2016 at 6:30 | comment | added | PaulHK | A texture is just a normal buffer, although in the fragment shader we use fancy sampler2D to read it with filtering/etc. You can use a compute shader to read it more in its raw form and skip the texture sampler stage. | |
Aug 2, 2016 at 6:28 | comment | added | BPiek | Isn't it a bit restrictive? I mean, IMO, the texture is not the best-suited data storage for passing data in general (but I am new to computer graphics and maybe I have to get used to it). | |
Aug 2, 2016 at 6:17 | history | answered | PaulHK | CC BY-SA 3.0 |