glReadPixels with null pointer
Tim Sheerman-Chase <[email protected]> Mon, 02 Sep 2013 18:59:01 +0100
| Newsgroups | gmane.comp.python.opengl.devel |
|---|---|
| Message-ID | <[email protected]> |
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
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net