Is it possible to update image data at video speed?

Are you developing an External using the LiveCode Externals SDK?

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
JeroenL
Posts: 5
Joined: Tue Jan 27, 2015 1:03 pm

Is it possible to update image data at video speed?

Post by JeroenL » Wed Jul 13, 2016 12:37 pm

I need to show a panoramic view inside my livecode app and I wish to overlay lines, rectangles, circles, polygons, etc. on top of the view using livecode itself.
I have currently implemented the code that generates the camera view in C++, by saving it to file and loading the image data directly into an existing image (with the same size) on my stack (using URL and "set the imagedata"). But even when I load the data from a RAM drive, it still takes almost a second to update the image on the screen in livecode.

If I would use my C++ code as an External lib, would it be possible to update the contents of an image object at video speed, or in some other way display it fast in the background so I can draw objects on top of it in livecode?
Or would I only be able to get a decent frame rate by assigning a viewport overlay, and drawing the necessary objects on top of the view from within my C++ code itself, rather than in livecode?

Klaus
Posts: 10326
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Is it possible to update image data at video speed?

Post by Klaus » Wed Jul 13, 2016 4:40 pm

Dag Jeroen,

you could try to set the FILENAME of your image instead of setting its IMAGEDATA.
This is a lot faster, but I don't know if that will be possible at "video" speed, at least worth a try!

Sorry, no idea about the other stuff...


Best

Klaus

Klaus
Posts: 10326
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Is it possible to update image data at video speed?

Post by Klaus » Wed Jul 13, 2016 4:47 pm

Dag Jeroen,

another idea! :D

If your "panoramic view" is a VIDEO (MP4 or any compatible format), then you can use a player object and set its ALWAYSBUFFER to TRUE.
Unfortunately this does not work in LC 8.01 but does work in LC 8.02 RC3 and LC 8.1 DP2.

This way you can put any LC object on top of the video player object!


Best

Klaus

JeroenL
Posts: 5
Joined: Tue Jan 27, 2015 1:03 pm

Re: Is it possible to update image data at video speed?

Post by JeroenL » Wed Jul 13, 2016 6:56 pm

Hi Klaus,

Thanks for the ideas. I didn't know it would be faster to let livecode reload the image from file completely. I hope it also works by setting the same filename again, since the filename stays the same. I'm just updating the image data all the time. But to try that out I'd have to actually format a complete BMP file, rather than just the pixel data themselves. Doesn't seem too difficult, and if it makes it a bit faster at least it would be better than what I have now without too much effort.

The video option won't be possible because the view needs to change according the user dragging the mouse in a certain direction to change the camera direction. But if the video player can be put underneath other objects, it gives me some hope that it should be possible to do the same with a widget that displays the view generated by my external code.

Post Reply

Return to “Building Externals/Plugins”