Question

The following functions does not work for me (pyopengl and opengl 4.2).

Am I doing something wrong?

glGetIntegerv(GL_MAX_FRAMEBUFFER_WIDTH)

KeyError: ('Unknown specifier GL_MAX_FRAMEBUFFER_WIDTH (0x9315)', 'Failure in cConverter ', (GL_MAX_FRAMEBUFFER_WIDTH,), 1, )

glGetFramebufferParameteriv(GL_DRAW_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_WIDTH)

OpenGL.error.NullFunctionError: Attempt to call an undefined function glGetFramebufferParameteriv, check for bool(glGetFramebufferParameteriv) before calling

glFramebufferParameteri(GL_DRAW_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_WIDTH, 512);

OpenGL.error.NullFunctionError: Attempt to call an undefined function glFramebufferParameteri, check for bool(glFramebufferParameteri) before calling

Example code:

from __future__ import division
import OpenGL
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *

def InitGL():
    glClearColor(0.0, 0.0, 0.0, 0.0)
    glClearDepth(1.0)
    glShadeModel(GL_SMOOTH)
    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    gluPerspective(45.0, 800 / 600, 0.1, 100.0)
    glMatrixMode(GL_MODELVIEW)


def DrawGLScene():
    fbo = glGenFramebuffers(1)
    glBindFramebuffer(GL_FRAMEBUFFER, fbo)
    #folowing not working
    print glGetIntegerv(GL_MAX_FRAMEBUFFER_WIDTH);
    print glGetFramebufferParameteriv(GL_DRAW_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_WIDTH)
    glFramebufferParameteri(GL_DRAW_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_WIDTH, 512);
    glFramebufferParameteri(GL_DRAW_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_HEIGHT, 512);

glutInit(sys.argv)
glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH)
glutInitWindowSize(800, 600)
window = glutCreateWindow("")
glutDisplayFunc(DrawGLScene)
InitGL()
DrawGLScene()
Was it helpful?

Solution

Every one of the errors you listed is symptomatic of an implementation that does not support the GL_ARB_framebuffer_no_attachments extension. The features you are trying to use went core in OpenGL 4.3, to use them in 4.2 you must have support for the above-mentioned extension.

That said, considering this really is not a special hardware feature, you can probably fix this problem just by upgrading your drivers. If your hardware is from NV or AMD anyway.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top