Accessing the Backbuffer

TL;DR: Is something similar to Processing’s load/updatePixels functionality without a structure that requires declaring the default display as PImage/PGraphics available in OPENRNDR?

I wonder this in part because of the line in the guide under Headless Applications that goes like this:

Headless applications cannot draw on the backbuffer, because there is no backbuffer. In order to draw you need to create a RenderTarget and draw on there.

Reading some source code mainly looking for a way to read pixel color values from the (assumed) backing colorbuffer to which a straight-forward sketch draws (not by user-defined render targets), I stumbled upon a few things:

interface ProgramRenderTarget

Driver.instance.activeRenderTarget

I tried with activeRenderTarget but had no luck, for it carried no colorBuffers and throwed an index out of bounds error.

And as to implementing something from the ProgramRenderTarget interface… Well, I’m kind of clueless. I don’t know if a RenderTarget that wraps around the backbuffer is what I need, though it sounds really interesting and I’d really like to know more about it.

Thanks for stopping by.

Hi :slight_smile: What are you trying to do? Change pixels on the screen, draw a shape and access the pixels of the drawing? without creating a colorBuffer?

With a colorBuffer there are examples at Color buffers - OPENRNDR GUIDE

Are you running your program headless? (on a server)

There is currently no way to access the contents of the back buffer directly. Indeed ProgramRenderTarget is the closest you can get to it. Since we don’t have anything in place to represent non-texture frame buffer attachments that’s kind of where it ends now.

Curious to hear use cases.