0

I have a python 3.3 application that visualizes a structure using PyOpenGL. It has a function to save the drawing in an image file.

def save_image(self, filename):
    glPixelStorei(GL_PACK_ALIGNMENT, 1)
    data = glReadPixelsui(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE)
    ...

It works fine until I make a standalone application for Windows using cx_freeze. Then I get the following error:

File "C:\mmpe\programming\python\h2-visualization\gui\StructureVisualizationWidget.py", line 97, in save_image
    data = glReadPixelsui(0, 0, self.width, self.height, GL_RGB, GL_UNSIGNED_BYTE)
File "C:\WinPython-64bit-3.3.3.2\python-3.3.3.amd64\lib\site-packages\OpenGL\GL\images.py", line 253, in glReadPixels
    imageData
ctypes.ArgumentError: argument 7: <class 'TypeError'>: No array-type handler for type <class 'ctypes.c_void_p'> (value: c_void_p(198443072)) registered

I get the same error if I extract the library.zip file and run it using the normal python.exe

Mads M Pedersen
  • 579
  • 6
  • 16

1 Answers1

0

I had to explicitly include:

OpenGL.arrays.ctypesparameters

in the cx_freeze distribution

Mads M Pedersen
  • 579
  • 6
  • 16