Framebuffer doesn't work because of framebuffer status is 36061

Started by Evgeny, December 25, 2020, 22:04:24

Previous topic - Next topic


Hey Guys. I use lwjgl 3.2.3, my videocard nvidia tesla m60, driver 440.59, ubuntu 18.04
I want to create multisample frame buffer and for that I do the following:
class MultisampleFrameBuffer(private val width: Int, private val height: Int) {

    private val rboColorId = glGenRenderbuffers()
    private val rboDepthId = glGenRenderbuffers()
    private val fboMsaaId = glGenFramebuffers()
    private val sampleFrameBuffer: SampleFrameBuffer

    init {
        glBindRenderbuffer(GL_RENDERBUFFER, rboColorId)
        glRenderbufferStorageMultisample(GL_RENDERBUFFER, NUMBER_OF_SAMPLES, GL_RGBA16, width, height)

        glBindRenderbuffer(GL_RENDERBUFFER, rboDepthId)
        glRenderbufferStorageMultisample(GL_RENDERBUFFER, NUMBER_OF_SAMPLES, GL_DEPTH_COMPONENT24, width, height)

        glBindFramebuffer(GL_FRAMEBUFFER, fboMsaaId)

        glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rboColorId)
        glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboDepthId)

        sampleFrameBuffer = runCatching {
            val fboStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER)
            check(fboStatus == GL_FRAMEBUFFER_COMPLETE) {
                "Could not configure the multi frame buffer objects: $fboStatus"
            glBindFramebuffer(GL_FRAMEBUFFER, 0)

            SampleFrameBuffer(width, height)
        }.onFailure { destroyInternally() }

    private fun destroyInternally() {
        glBindFramebuffer(GL_FRAMEBUFFER, 0)

    companion object {
        private const val NUMBER_OF_SAMPLES = 8

Sometime framebuffer is created corrctly and I can use it, but some time I start to get framebuffer status 36061 and when it is happened and I can't create buffer anymore because I always get this status.
What do I do wrong ? Could somebody help me ?