GLBasic forum

Main forum => GLBasic - en => Topic started by: matchy on 2016-Jan-16

Title: Passing an array to another cpp?
Post by: matchy on 2016-Jan-16
On Linux/RPi, how can I fast pass an array (not command args nor serial) from a running GLBasic program to a running cpp (compiled with g++)?  :'( :S
Title: Re: Passing an array to another cpp?
Post by: Schranz0r on 2016-Jan-18
Write to a file or use a scriptlanguage like LUA?
Title: Re: Passing an array to another cpp?
Post by: matchy on 2016-Jan-18
A file (or serial) stream seems to be my only option and I will have to try this now. I have done this before with a webcam image crated in opengl then opened in glbasic. It just requires an incremented file and then a follow up clean up. I suppose I can research g++ to g++ later.
Title: Re: Passing an array to another cpp?
Post by: Kitty Hello on 2016-Jan-20
To another process or a linked library?
Title: Re: Passing an array to another cpp?
Post by: matchy on 2016-Jan-21
"Experimental demo of 1K of bitmap data from 3D GLB screen and then read on the RPi2 via cpp that runs the monochrome OLED.
In this case the GLBasic app is running on Windows and saving locally with a forced frame delay of 100ms without frame drops. The RPi2 is connected via network drive to read the data.
If could be faster if the bitmap array (even larger colour buffers) could be passed to the process directly and also the GLB app can run on the Rpi also.
This is similar to my Nokia monochrome LCD video stream demo."

Title: Re: Passing an array to another cpp?
Post by: UBERmonkeybot on 2016-Jan-21
That's cool.Nice.   =D
Title: Re: Passing an array to another cpp?
Post by: erico on 2016-Jan-22
Funky groovy experimentation! Do you have a final intention with it?
Title: Re: Passing an array to another cpp?
Post by: matchy on 2016-Jan-22
Not entirely sure what a need would be but I am thinking how it might be more portable with the Pi0. I'm sure I could demo a game but the idea that GLBasic is drawing rather than cpp. Note it's not the re-imaging that's new here as it's simply writing/reading a file. I've done this with Arduino serial video but this time I was hoping to get this 1k file as an array directly to the process. As you can see I used the Rpi2, as I am hesitant to solder in header pin in the Pi0 just for a general demo video.
Title: Re: Passing an array to another cpp?
Post by: erico on 2016-Jan-22
So, you have a glb program running on PC that sends data to a glb program running on Pi and it uses this data to draw?
Is that what is actually happening?
Title: Re: Passing an array to another cpp?
Post by: matchy on 2016-Jan-22
No, it simply saves to a file. In this case over netbios but I was/am aiming for a RPi local version because the whole point to this thread is to casually find out how to get it sent to the process, not a cool demo otherwise my video wouldn't be unlisted.  :zzz:
Title: Re: Passing an array to another cpp?
Post by: Marmor on 2016-Jan-23
what is your goal ? i cant understand.

i build a sort of wrapper for 2d commands on the rpi , it reads the serial data from my micromite
and shows it.

Title: Re: Passing an array to another cpp?
Post by: matchy on 2016-Jan-23
We really need to post less experimental video demos.   :'(

There's not more that I can imagine unless anyone has some ideas to share. The most sensible I can think of, aside from games, is 3D navigation mapping but doesn't seem practical.  :x

Title: Re: Passing an array to another cpp?
Post by: kanonet on 2016-Jan-23
So if I got it right, you want to send data from one program to an other? You can do this with SOCK_ command, thats what i did between 2 instances of my DDGui-Creator.
Title: Re: Passing an array to another cpp?
Post by: matchy on 2016-Jan-23
That is how I send via a web server but with TCP not UCP like with the multiplayer game. Perhaps I wil try that then.  ;)
Title: Re: Passing an array to another cpp?
Post by: Marmor on 2016-Jan-24



http://www.raspberry-projects.com/pi/programming-in-c/memory/shared-memory-between-c-application-and-php-web-server (http://www.raspberry-projects.com/pi/programming-in-c/memory/shared-memory-between-c-application-and-php-web-server)
Title: Re: Passing an array to another cpp?
Post by: matchy on 2016-Jan-24
That example looks like it. :) Just need to conver that PHP code to GLBasic. For example, where is sem_get()?  :whistle:
Title: Re: Passing an array to another cpp?
Post by: Marmor on 2016-Jan-24
http://openbook.rheinwerk-verlag.de/linux_unix_programmierung/Kap09-006.htm (http://openbook.rheinwerk-verlag.de/linux_unix_programmierung/Kap09-006.htm)

this will help