[ pyopengl-Bugs-2561765 ] Wrong image size for glReadPixels()

"SourceForge.net" <[email protected]> Sun, 19 Jul 2009 00:08:11 +0000
Newsgroups gmane.comp.python.opengl.devel
Message-ID <[email protected]>
Bugs item #2561765, was opened at 2009-02-03 14:26
Message generated for change (Comment added) made by mcfletch
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105988&aid=2561765&group_id=5988

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Andrew Straw (astraw)
Assigned to: Nobody/Anonymous (nobody)
Summary: Wrong image size for glReadPixels()

Initial Comment:
I've been tracking down an error with the Vision Egg and PyOpenGL 3. (This code works fine with PyOpenGL 2.) The code that led me to this issue is line 476 of VisionEgg/Core.py [1], which is a call to glReadPixels(). Basically, doing glReadPixels with a format of GL_BGRA and type of GL_UNSIGNED_INT_8_8_8_8_REV returns an NxMx4 array of type uint32. I think this should either be an NxM(x1) array of type uint32 or an NxMx4 array of type uint8.

The code at issue seems to be in OpenGL.images.createTargetArray(). It is responsible for creating the mis-sized array. I hesitate to suggest a patch, since I'm not sure what the optimal solution is, but this is at least a change of behavior since PyOpenGL 2.

I am including a test which hopefully clarifies my thinking about the proper size of the array.

[1] http://visionegg.org/trac/browser/tags/release_1.1.2/VisionEgg/Core.py#L476

----------------------------------------------------------------------

>Comment By: Mike C. Fletcher (mcfletch)
Date: 2009-07-18 20:08

Message:
Hi Andrew, thanks for the bug report, and particularly for the test case. 
I've added a table to the OpenGL.images module which enumerates the packed
image types and overrides the calculation for their case, as well as
checking that the format can hold the number of components specified (at
least).  bzr head has the fix.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105988&aid=2561765&group_id=5988

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net