stevenlovegrove / Pangolin

Pangolin is a lightweight portable rapid development library for managing OpenGL display / interaction and abstracting video input.
MIT License
2.39k stars 854 forks source link

How to write to the default Display/Framebuffer? #914

Closed xingruiyang closed 8 months ago

xingruiyang commented 8 months ago

I would like to write to a second framebuffer first then copy to the default Display w/ GUI, but I can't figure out how to get the screen size of the default fb.

Specifically I want to use the OpenGL glBlitNamedFramebuffer function to copy render results:

    glBlitNamedFramebuffer(
        frameBuffer_.fbid, 0,
        0, 0, render_size.w, render_size.h,
        0, 0, frame_size.w, frame_size.h,
        GL_COLOR_BUFFER_BIT, GL_NEAREST);

with render_size = (640, 480) and frame_size = (1920,1080). The pangolin window is created with (1920,1080).

But that gives error, OpenGL gives 502 ERROR. However the same code is working if I set frame_size = (640,480), but the result is not what I want, it only occupies a small portion of the screen.

My question is how to get the correct display dimensions?

xingruiyang commented 8 months ago

Never mind, I figure that out, the viewport can be accessed through d_cam.v in case anyone is curious.