DenseHumanBodyCorrespondences icon indicating copy to clipboard operation
DenseHumanBodyCorrespondences copied to clipboard

PyOpenGL error: OpenGL.error.GLError

Open yanghtr opened this issue 5 years ago • 1 comments

I am trying to predict feature for 3D human mesh using the command:

python predict.py --checkpoint ./models/alex-SM-5/model --output feature.npy --mesh ./test.obj --flipyz

However, there is an error:

Traceback (most recent call last):
  File "predict.py", line 96, in <module>
    output = generate_mesh_feature(sess, input, feature, args.mesh, args.flipyz)
  File "predict.py", line 19, in generate_mesh_feature
    renderer = GLRenderer(b'generate_mesh_feature', (conf.width, conf.height), (0, 0), toTexture=True)
  File "/***/DenseHumanBodyCorrespondences/gl/glrender.py", line 87, in __init__
    self.program = LoadProgram(shaderPathList)
  File "/***/DenseHumanBodyCorrespondences/gl/glrender.py", line 20, in LoadProgram
    shader = glCreateShader(shaderType)
  File "errorchecker.pyx", line 53, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError (src/errorchecker.c:1218)
OpenGL.error.GLError: GLError(
        err = 1280,
        description = b'invalid enumerant',
        baseOperation = glCreateShader,
        cArguments = (GL_GEOMETRY_SHADER,),
        result = 0
)

My environment is python3, PyOpenGL 3.1 (latest version), and glxinfo| grep -i opengl get:

OpenGL vendor string: VMware, Inc.
OpenGL renderer string: llvmpipe (LLVM 6.0, 256 bits)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 18.0.5
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 18.0.5
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 18.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:

I did not modify the code. It seems that it is an error related to PyOpenGL. I tried to modify the code by specifying the context of OpenGL. In gl/glrender.py, I specified the context by adding glutInitContextVersion(3, 2):

class GLRenderer(object):
    def __init__(self, name, size, pos, toTexture=False, shaderPathList=None):
        self.width, self.height = size
        self.toTexture = toTexture

        glutInit()
        displayMode = GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH | GLUT_STENCIL | GLUT_BORDERLESS | GLUT_CAPTIONLESS
        glutInitDisplayMode (displayMode)
        glutInitWindowPosition(pos[0], pos[1])
        glutInitWindowSize(self.width, self.height)
        glutInitContextVersion(3, 2)  # add this line: GL_GEOMETRY_SHADER need opengl core 3.2
        self.window = glutCreateWindow(name)
        #glutFullScreen()
        glEnable(GL_CULL_FACE)
        glEnable(GL_DEPTH_TEST)
        glDepthFunc(GL_LESS)

Then there is indeed no bug about GL_GEOMETRY_SHADER. However, another bug comes in:

Traceback (most recent call last):
  File "predict.py", line 96, in <module>
    output = generate_mesh_feature(sess, input, feature, args.mesh, args.flipyz)
  File "predict.py", line 19, in generate_mesh_feature
    renderer = GLRenderer(b'generate_mesh_feature', (conf.width, conf.height), (0, 0), toTexture=True)
  File "/***/DenseHumanBodyCorrespondences/gl/glrender.py", line 73, in __init__
    glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE, GL_INTENSITY)
  File "errorchecker.pyx", line 53, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError (src/errorchecker.c:1218)
OpenGL.error.GLError: GLError(
        err = 1280,
        description = b'invalid enumerant',
        baseOperation = glTexParameteri,
        cArguments = (
                GL_TEXTURE_2D,
                GL_DEPTH_TEXTURE_MODE,
                GL_INTENSITY,
        )
)

It seems that GL_DEPTH_TEXTURE_MODE is an old function from OpenGL 2.x. It is kind of contradictory. I don't know what the correct environment is and how to run the code for human mesh feature prediction.

yanghtr avatar Nov 23 '19 01:11 yanghtr

Hi, did you resolved the opengl problem, i am facing the similar error

kdanishh avatar Jun 27 '20 06:06 kdanishh