[PyOpenGL-Users] glGetTexImage weirdness
Brought to you by:
mcfletch
From: Gijs <in...@bs...> - 2009-02-19 09:27:32
|
Hello List, I'm trying to find why glGetTexImage works the way it does. With the following piece of code, I expect both prints to be the same. pixels = zeros(1*4, 'i') + 97 img = glGenTextures(1) glBindTexture(GL_TEXTURE_2D, int(img)) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels) 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. Regards, Gijs |