A GL_BITMAP and bitwise operations question

JoN <[email protected]>
Newsgroups gmane.comp.python.opengl.devel
Message-ID <[email protected]>
Ok these aren't strictly OpenGL questions, the first is more a pure Python
question but, I thought I'd ask it here anyway. The GL_BITMAP question is
definitely Python OpenGL.

In C I can declare an array of char, but using pointer arithmetic I can process
it as though it were an array of integers - ie. 32 bits (4 chars) at a time.

Question 1:  Bitwise array processing in Python.
Is there any way to do such a thing efficiently in Python ?  eg. using Numpy, or
am I looking at having to write a C module ?

Application: I want to read back a chunk of the stencil buffer from the graphics
card, which OpenGL and Python OpenGL _will_ let me do, as a bitmap.


Question 2: GL_BITMAP storage format in Python.
Now even _there_ is a problem - glReadPixels() from the stencil buffer masked to
1 bit (lsb) with a GL_BITMAP target returns what in Python ?
A string ?


Anyway, because the return a bitmpap, each byte is 8 pixels, one bit per pixel i
want to process them in groups of 4 bytes (just bitwise logical ops) - its
trivially easy in C, but I can't see any way to do it in Python that is fast
because Python's data types are a bit abstracted.

Anybody attempted this feat or got any ideas on the above questions ?

Best
Jon



--------------------------------------------------------------------
Come and visit Web Prophets Website at http://www.webprophets.net.au


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.