violin's picture

Rendering offscreen with a FBO object

Hello Guys,

I am trying to do something very specific: to use OpeTK to render on an offscreen Framebuffer-Object, then use the buffer pixels in my application. If I'm not wrong, I need to create my own graphics context, but it requires a window handle, which I don't have. GameWindow and GLControl, however, do create a window. Any idea or tips how I can do that?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

OpenTK does not support non-window contexts.

The solution is to create a regular, invisible window. If you are using Windows.Forms or WPF create a GLControl, call its CreateControl() method but don't attach it anywhere. In all other cases, create a GameWindow and don't call its Run() method.

This is a supported use case and will work correctly as long as your application can access the video hardware (i.e. in all cases other than windows services and headless/network servers).