Re: [PyOpenGL-Users] glGetTexImage weirdness
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@vr...> - 2009-02-19 16:43:05
|
Gijs wrote: ... > data = glGetTexImageub(GL_TEXTURE_2D, 0, GL_RGBA) > print data > data = glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE) > print data > > As I expect that PyOpenGL would pass GL_UNSIGNED_BYTE to the underlying > function when I use glGetTexImageub, and that if I pass the type myself > directly, the result would be the same. But in the first case I get a > proper response, containing [[[97 97 97 97]]], and the second I get a > rather weird response "aaaa" (a string). In the end it's of course quite > easy to work around it, since you can just use the glGetTexImageub > function, but when I stumbled upon it, it took me quite some time to > find it since I assumed both would be the same. > It's a legacy compatibility feature requested to be re-instated by the Pygame folks. See the flag: UNSIGNED_BYTE_IMAGES_AS_STRING in the OpenGL/__init__.py module for how to go back to always getting back your "normal" array types. IIRC some common function in the released versions of Pygame was using the function expecting a string back (PyOpenGL 2.x behaviour) and broke with 3.x returning the registered preferred array handler type. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |