Getting default frame buffer id from GLKView/GLKit

后端 未结 3 1324
旧时难觅i
旧时难觅i 2021-02-05 13:41

I use GLkit/GLKView in my IOS OpenGL ES 2.0 project to manage default FBO/life cycle of my app.

In desktop OpenGL in order to bind default FBO (the front buffer) I can j

3条回答
  •  -上瘾入骨i
    2021-02-05 14:35

    The answer that is given is definitely the proper solution, however it does not address the error in your understanding of the conceptual difference between standard openGL and openGL for embedded systems. //----------------------------------------------- I feel it's necessary to point out here that the call to glBindFramebuffer(GL_FRAMEBUFFER, 0) does not return rendering to the main framebuffer although it would appear to be so for machines that run Windows, Unix(Mac) or Linux. Desktops and laptops have no concept of a main default system framebuffer. This idea started with handheld devices. When you make an openGL bind call with zero as the parameter then what you are doing is setting this function to NULL. It's how you disable this function. It's the same with glBindTexture(GL_TEXTURE_2D, 0); It is possible that on some handheld devices that the driver automatically activates the main system framebuffer when you set the framebuffer to NULL without activating another. This would be a choice made by the manufacturer and is not something that you should count on, this is not part of the openGL ES spec. For desktops and laptops, this is absolutely necessary since disabling the framebuffer is required to return to normal openGL rendering. But remember! this is not a return to any main framebuffer, you are shutting down the activated frame buffer.

提交回复
热议问题