[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Re: Accessing opengl surface as a numpy array



Hi,

I tried both solutions (full read back or one pixel access) and in my
case the latter one is clearly faster since sampling rate reduces
information by a factor of 10**3. There are only several hundreds
receptive fields cells which read some pixels, instead of a full
800x600 pixels sized display to copy back to the cpu's memory...

I understood what you explain to me about GPU and CPU sides, but I do
not have the choice about the input type and it is not possible to
move my processes onto the GPU side.

Thanks again, you make my work easier.
See you.

2010/11/15 Ian Mallett <geometrian@xxxxxxxxx>:
> Hi,
>
> Depending on your sampling rate, it may be best to just copy all the data
> back, and then select only those samples you want.  These operations are
> easily vectorized, and the Python overhead, combined with the requests to
> and from the GPU might not be worth individually getting pixels.
>
> Once again, the pixels live on the GPU, so no analogous surfarray exists.
> You'll have to do some copying, or else do all the work entirely on the GPU
> or on the CPU.
>
> If you're processing video, you're sending the video data to the GPU and
> then reading it back one sample at a time.  Probably a better approach is
> to, when loading the video, simply pick out the appropriate frame as
> required.
>
> Ian
>