Skip to content

同一個FrameBuffer綁定2次會有影響碼?比如導致1285 #2

Description

@uchiaitachipro
fun attachTexture(texture: Texture) {
    attachedTexture?.decreaseRef()
    attachedTexture = texture
    if (frameBuffer == GL_NONE) {
        frameBuffer = GLUtil.createFrameBuffer()
    }
    **bind()**
    Util.assert(texture.width > 0 && texture.height > 0 && (texture.type == GL_TEXTURE_2D || texture.type == GLES11Ext.GL_TEXTURE_EXTERNAL_OES) && glIsTexture(texture.texture) && frameBuffer > 0, "texture error")
    glCheck { glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture.type, texture.texture, 0) }
}


override fun bindOutput() {
    output?.let { outputTexture ->
        FrameBufferPool.obtainFrameBuffer().apply {
            attachTexture(outputTexture)
            **bind()**
            Util.assert(outputTexture.width > 0 && outputTexture.height > 0, "output size error")
            glCheck { glViewport(0, 0, outputTexture.width, outputTexture.height) }
        }
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions