problem saving openGL FBO larger than window

后端 未结 4 1607
栀梦
栀梦 2021-02-14 07:30

I\'m rendering into an OpenGL offscreen framebuffer object and like to save it as an image. Note that the FBO is larger than the display size. I can render into

相关标签:
4条回答
  • 2021-02-14 07:55

    Two questions to start: How are you creating imageSaver and are you sure your width and height are correct (e.g. are you trying to save a 1024 x 1024 image? What size are you getting)?

    0 讨论(0)
  • 2021-02-14 08:03

    This sounds like you have the wrong viewport size or something similar.

    0 讨论(0)
  • 2021-02-14 08:05

    Finally I solved the issue.

    I have to activate the fbo for saving its contents:

    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
    // save code
    ...
    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
    

    while only selecting the fbo for glReadPixels via

    glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
    

    doesn't suffice.

    (All other things where correct and tested, eg. viewport sizes, width and height of buffer, image texture etc.)

    0 讨论(0)
  • 2021-02-14 08:07

    You're not doing anything wrong, this has been quite common behaviour with OpenGL graphics drivers for a long time - I recall running up against exactly the same issue on nVidia Geforce 3 cards at least a decade ago, and I adopted a similar solution - rendering to an offscreen texture.

    0 讨论(0)
提交回复
热议问题