开发者

OpenGL out of memory error, large FBO

I'm getting out of memory errors when creating a large (2^13) framebuffer object in PyOpenGL/PyQt:

    width = 8192
    height = 8192

    self.textureFbo = QtOpenGL.QGLFramebufferObject(width,height)
    self.textureFbo.bind()

    texture = self.bindTexture(QtGui.QPixmap(self.textureFilePath)) # 2^13
    glClearColor (0.0,开发者_运维知识库 0.0, 0.0, 0.0);
    glClear (GL_COLOR_BUFFER_BIT);

    glLoadIdentity()
    glViewport(0, 0, width, height)
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity()
    glOrtho(0, +1, +1, 0, -0.1, 2.0);

    glBegin(GL_POLYGON);
    glTexCoord2d(1.0, 0.0)      
    glVertex3f (0.0, 0.0, 0.0)
    glTexCoord2d(1.0, 1.0)
    glVertex3f (1.0, 0.0, 0.0)
    glTexCoord2d(0.0, 1.0)
    glVertex3f (1.0, 1.0, 0.0)
    glTexCoord2d(0.0, 0.0)
    glVertex3f (0.0, 1.0, 0.0)
    glEnd();

    self.deleteTexture(texture)
    self.textureFbo.release()
    self.textureFboLoaded = True

gives:

OpenGL.error.GLError: GLError(
        err = 1285,
        description = 'out of memory',
        baseOperation = glClear,
        cArguments = (GL_COLOR_BUFFER_BIT,)
)
QGLFramebufferObject: Framebuffer incomplete attachment.
Traceback (most recent call last):
  File "main.py", line 286, in paintGL
    self.loadTextureFBO()
  File "main.py", line 357, in loadTextureFBO
    glEnable(GL_TEXTURE_2D)
  File "C:\Python27\lib\site-packages\OpenGL\error.py", line 208, in glCheckErro
r
    baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
        err = 1285,
        description = 'out of memory',
        baseOperation = glEnable,
        cArguments = (GL_TEXTURE_2D,)
)
QImage: out of memory, returning null image

However this works fine if I step down to either a 2^12 texture, or FBO.

It seems unreasonable to me that two images (FBO+texure) of around 132mb 268mb each (4 bytes*8192^2) should fill up my 1gb of video memory. What am I missing?


First, note that 4 x 8192^2 is 268M, not 132, so we're talking over half a GB, for these two objects. Presumably there are other demands on memory, too. I agree it sounds like you should not have a problem, but I don't know what else is going on.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜