Dynamic texture loading / deleting. Raspberry PI 3

Started by bobtarask, September 01, 2016, 01:46:18 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

bobtarask

Hello,

I have a list of images ( ~ 100 images in PNG format) that I need to display in a timed sequence (like a movie)

I use textures to display the images (like in the demo http://www.geeks3d.com/hacklab/20151207/how-to-control-the-window-opacity-on-the-raspberry-pi/).

Creating the texture works: with the function  gh_texture.create_from_file_v3 from the API (http://www.geeks3d.com/geexlab/reference/scripting_texture.php). I load the images at initialization, and then I am able to display the images in the FRAME script. But I am currently limited to 10 textures simultaenously in the GPU.

Is it possible to update the GPU textures from a seperated thread / process ? ( I cannot do it in the FRAME script because it takes too much time to load the texture from file, affecting the display)

Also I tried to use the functions to update textures :

gh_texture.update_gpu_memory_from_file
gh_texture.update_gpu_memory_from_buffer


but neither worked or I was not able to use them properly..

And I didn't find any way to free the textures from the GPU ?

Maybe it could be done with gh_texture.reset_texture_unit ? But I don't understand the arguments of the function.

Could someone help in those matters ?

Thanks and best regards

Etienne




JeGX

gh_texture.update_gpu_memory_from_file() should work on RPi. The parameters are:


gh_texture.update_gpu_memory_from_file(texture_id, image_filename, is_abs_path)


texture_id is the id of an existing texture (created for example with gh_texture.create_2d() or with gh_texture.create_from_file()). And the new texture you want to upload must have the same dimensions than the existing texture.

To kill a texture just use:

gh_node.kill(texture_id)



What I should add to GeeXLab is a function to load a texture in the CPU memory only. Then later, with another function you can upload this CPU texture into GPU memory. I will try to add these functions asap.


bobtarask

Hello thanks a lot for the support,

For our slides show (we are displayed HTML5 dynamically generated slides with transparency over a video playing in background) it was fine to spawn new demo processes each one displaying the next slide at  a defined time).

We had also had to find a way to pass arguments to the demo scripts. We managed to pass parameters through a file named after the process id. But maybe there is a way to pass the command line arguments to the lua scripts ?


Have a nice day,

Etienne

JeGX

You can retrieve the command line in a script with:


command_line = gh_utils.get_command_line()


Once you have the command_line, just parse it with Lua/Python string functions to extract parameters.

bobtarask

Cool thanks again! without your help and your code we would not have been able to satisfy the requirements.  Your work on the PI is pretty cool. It is the only library I found managing transparency.

Also I had a last question, is it possible to set the window size from the script or to pass it to the XML through command line parameters ?

If not possible I will have to hack the XML before running GeexLab.

Best regards,

Etienne


JeGX

cuurently, the only ways to bypass the window size defined in the XML are: command line or init0.xml.

Command line:

geexlab /width=1024 /height=400


init0.xml:

<glslhacker_init
    demofile=""
    width="1024"
    height="400"
/>


Let me know if that helps.

bobtarask

Hello,

merci c'est parfait on a utilisé les arguments en ligne de commande /width /height.

Bon dimanche