[PyOpenGL-Devel] glReadPixels with null pointer
Brought to you by:
mcfletch
From: Tim Sheerman-C. <ord...@sh...> - 2013-09-02 18:54:22
|
Hi all, I had problems when using glReadPixels when the data buffer pointer passed to the function is zero: glReadPixels(0, 0, capSize[0], capSize[1], GL_BGRA, GL_UNSIGNED_BYTE, 0) I was doing this while reading from a pixel buffer object. This caused a segmentation fault in OpenGL/GL/images.py when simple.glReadPixels is called. I found a way to fix this by setting the variable to ensure it is a "None" pointer. if array is None: array = images.SetupPixelRead( format, (width,height), type ) else: if array != 0: array = arrayType.asArray( array ) else: array = arrayType.asArray( None ) imageData = arrayType.voidDataPointer( array ) simple.glReadPixels( x,y, width, height, format,type, imageData This branch fixes the segfault problem: https://code.launchpad.net/~thetourist/pyopengl/tim Regards, Tim Sheerman-Chase |