Page 1 of 1

glGetTexImage for TOPs

PostPosted: Fri Aug 03, 2018 7:46 am
by soriak
Hi,

after trying several workarounds to have a more or less performant (not freezing the network for too long) way of getting the channel values of a Float texture in TD (top.sample() / toptochop), I feel like there should/must be a better way to access the texture data within python for further manipulation on the cpu.

I stumbled upon this openGL feature https://www.khronos.org/opengl/wiki/GLAPI/glGetTexImage

could this provide a performance boost for these kind of situations?
and if so, could you expose this method(or a wrapper of it) as a method on TOPs?

thanks for considering..

Re: glGetTexImage for TOPs

PostPosted: Tue Aug 07, 2018 3:43 pm
by malcolm
We do download the texture data is the most performant way possible using GL. Texture downloads are just slow on current GPUs, and particularly slow on Geforce level cards.

On the Python side though things could potentially get faster if we had a way to get an entire image into a single Python object, rather than requiring multiple calls to top.sample(). We've been considering this for a while, as well as a way to get texture data into a OpenCV python object directly. So far this work hasn't been scheduled yet though. Thanks for your feedback!

Re: glGetTexImage for TOPs

PostPosted: Wed Aug 08, 2018 6:19 am
by soriak
I know this introduces some probably unwanted dependency, but a numpy array would probably be the fastest* anyways and that would already work for openCV if I'm not mistaken

*at least in the sense of further manipulation