Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Frame buffer for feedback effects

I'm wondering how I can make an opengl frame buffer that captures the screen to a texture that can be used in feedback effects?

Currently I'm experimenting with some of my realtime glsl optical flow shaders and want to have more flexibility. Ive been using a couple other apps to develop for glsl but codea seems very nice and I want to use it!


  • SimeonSimeon Admin Mod
    Posts: 4,352

    You can use setContext to render into an image buffer which can then be used as input to a shader. Is this kind of what you're thinking?

  • Cool, yeah it looks like making an image in the setup, setting that as the context in draw, and setting it back to the main window with setContext() works. I now have a rudimentary setup for making some multipass shaders that process sequentially. I noticed to use two textures I had to set the second one using myMesh.shader.texture2 = capturedTexture. When I tried setting myMesh.texture2 nothing happened.

  • SimeonSimeon Admin Mod
    Posts: 4,352

    @AxiomCrux that's correct, there are convenience setters for some of the default shader attributes (like texture), but your custom ones must be accessed through your shader instance.

  • Posts: 21

    @Simeon I have a program I made now that switches between a few shaders and captures them to images in different contexts, feeding them around to each other. But for some reason the program seems to lock up after a while of running. I am wondering if there is any housekeeping or potential garbage that is accumulating in ram if Im flipping different shaders onto my m:shader and drawing to different named image(WIDTH,HEIGHT)?

  • SimeonSimeon Admin Mod
    Posts: 4,352

    @AxiomCrux if you want to share it with me I'll run it through the instrumentation to check for memory leaks in the Codea runtime.

Sign In or Register to comment.