A few months ago I was trying to port over Nvidia's postprocessGL program,
as included with the CUDA SDK.
I am attempting to do this using the PyOpenGL bindings for python and using
pycuda. I'm a beginner to python, I know even less about openGL and less
still about CUDA, so I was mostly undertaking this as a learning excercise;
after getting frustrated about not know at all what to do I gave up for a
few months and I'm only now attempting again to make some sense of this.
I've put up a copy of my attempt so far over here:
Apologies for the very unpythonic way things are layed out, hopefully once I
have some sense of what I'm doing I'll tidy it up.
Right now I have a few problems that I'm hoping someone can clear up for me.
The first issue is to do with the pycuda.BufferObject class. I assume this
is for representing openGL pixel buffer objects, but I have no idea how to
give this PBO to the cuda kernel! The cuda kernel wants either a
DeviceAllocation, a GPUArray or something that implements the python buffer
interface... It seems like the pycuda.BufferObject class is none of these
things so how do I use it? The original C version of postprocessGL just
passes a pointer to the PBO to its kernel function.
The second problem may be out of the scope of this mailing list since its
more to do with pyopengl than pycuda per se, but if I run my program it
fails during the glReadPixels function call, with this openGL error:
err = 1282,
description = 'invalid operation',
baseOperation = glReadPixels,
cArguments = (
I've read the documentation and this error should only come up under a few
circumstances, none of which seems to be true as far as I can see
(invalid_operation is usually caused when glReadPixels would cause more data
to be written than the bound buffer could hold). Is there some other way of
setting up PBO's that I haven't figured out, or is anything in my code
If anyone can take a look at my source and offer any advice I'd really