Possible bug when binding a framebuffer

If its not only on my pc there is a bug somewhere when binding framebuffers.
It all depends on the framebuffer sizes.
Binding a smaller framebuffer then the previous one works
Binding a bigger framebuffer then the previous one does not work
Binding a framebuffer the same size as the previous one works

in the test case you can play with the target sizes in simpleInit()

    targetsize = new int[]{
            128, //CORRECT
            256, //WRONG
            512, //WRONG
            1024, //WRONG
            1024  //CORRECT
    };

    targetsize = new int[]{
            1024, //WRONG But depends on the resolution of the window
            512, //CORRECT
            256, //CORRECT
            128 //CORRECT
    };

    targetsize = new int[]{
            128, //CORRECT
            256, //WRONG
            512, //WRONG
            1024 //WRONG
    };

Here is the testcase:

would be nice of someone else could test is before i spend time tracking down an issue that is only on my computer

On my computer this is what comes out when running it

1 Like

Thank you. If all would work correct the pictures on top should show the same thing rendered in different resolutions

I can also reproduce it on my Linux machine

Tested with both my Intel and AMD GPUs
And with both Lwjgl 2 & 3 (just in case)

by looking at the calls to opengl it seems the gl_scissor gets called after gl_clear

One of the hints to this was that the results from you guys all looked differently. Mine looked only black.

Viewport(0, 0, 256, 256)
Clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT | STENCIL_BUFFER_BIT)
Scissor(0, 0, 256, 256)

Note: that above seems to be correct
Calling

renderManager.getRenderer().setClipRect(0, 0, targetsize[i], targetsize[i]);

manually before clearing fixes the issue.

TBH: The only reason i consider this a bug is because gl_scissors gets called after the call to gl_clear. If it would not be called at all this might be a feature

1 Like

As a final post. Setting up the camera i am going to use before setting up the fremebuffer i am going to use fixes things too.
This makes me think that it is not bug, but well unexpected behavior.
Not going to fix because it is more a design decision.

Hopefully nobody ever runs into this issue and if yes this thread might help.

3 Likes