copyFrameBuffer to mainbuffer?

Hey guys!

I found the renderer cannot copy a fbo to the mainbuffer or viceversa. I looked up the code and found this:



LwjglRenderer : copyFrameBuffer



[java]

if (dst == null) {

glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);

// dstW = viewWidth;

// dstH = viewHeight;

}

[/java]



So while it is being copied, the dst rect is 0,0,0,0 so the mainbuffer is unchanged. And the same happens if the src is the mainbuffer.

I don’t know if it is intentional or not, but a simple solution is just setting dstW, dstH to the mainbuffer size.



Thanks, and sorry for creating too many threads! :stuck_out_tongue:

You don’t copy a frameBuffer to the main buffer, you render the frameBuffer to a fullscreen quad. That’s the way post process filter are done.

Look at FilterPostProcessor especially the renderProcessing method

Yup, but I had to do it this way for a specific thing.

Anyway, I solved it by calling lwjgl directly.

@nehon said:
You don't copy a frameBuffer to the main buffer

Yes you can, you don't have to use any quads

Then how ?

The glBlitFramebuffer() call allows you to blit into the backbuffer. Notice it accepts “null” arguments.

But do note the format of the framebuffer and main buffer has got to be identical in color and depth.