mcfletch / pyopengl

Repository for the PyOpenGL Project
Other
320 stars 102 forks source link

glClear causes segmentation fault on OSMesa and OpenGL 2 #34

Open sabtorres opened 5 years ago

sabtorres commented 5 years ago

What the title says. My context is initialized like this

    shared_win = None
    ctx = mesa.OSMesaCreateContext(GL_RGB, shared_win)
    win = ctx
    buf = arrays.GLubyteArray.zeros((height, width, 3))
    mesap = arrays.ArrayDatatype.dataPointer(buf)
    assert(mesa.OSMesaMakeCurrent(ctx, GLuint(mesap), GL_UNSIGNED_BYTE, width, height))

Apparently I can only use OSMesa with OpenGL 2, otherwise I wouldn't be using it.

I'm using Linux openSUSE Tumbleweed with Mesa drivers version 19.1.5.

mcfletch commented 4 years ago

AFAICS you are simply using an unsupported mode for Mesa, though I can only guess that by creating my own test script which I've added on the develop branch. It does everything you're doing, but using RGBA mode instead of RGB. Your sample code doesn't call glClear, obviously, but the code does run to completion on Kubuntu 18.04.

You will find a working offscreen rendering test in tests/osdemo.py in the pyopengl repo.