Live coding openFrameworks applications

84 views
Skip to first unread message

Not Sure

unread,
May 9, 2015, 5:47:26 AM5/9/15
to runtimecompi...@googlegroups.com
Hi there!

First of all, thanks you guys for this project!

I made some initial progress recently to make CMake-based openFrameworks work with Runtime-Compiled C++, here is the result so far:

https://github.com/ofnode/ofLiveApp

It does compiles at runtime and it's super cool to see your changes without restarting the application! :) But I have a few questions which make me wonder -- am I doing this wrong (which is most probably!) or is there any way to introduce new objects at runtime without resetting their values on each runtime compile step?

Here's what I mean: right now to make camera object work, for example, I have to place it in a global struct which is created at the parent IObjectFactoryListener class and passed as a parameter to the functions of a live TInterface class. And it works, I can recompile at runtime without loosing the current position or orientation of the camera. But it works only if a camera object was created at compile time, not on runtime. If I declare it here in a live class it works too, but on each code update it resets its position, orientation and other parameters to defaults -- am I missing other way which prevents that, without declaring global struct at compile time?

Thanks!

Doug Binks

unread,
May 9, 2015, 6:08:03 AM5/9/15
to runtimecompi...@googlegroups.com
Hi!

Glad you like RCC++ - openFrameworks seems a great framework to use this in and I've been meaning to have a look at it for a while, but just not had the spare time yet.

In order to preserve data across runtimecompiles you need to save your state, either using your own system or by overloading the IObject::Serialize() function. For an example see:


Note that the SERIALIZE macro should work for most things, but for IObject Pointers we had to create a SERIALIZEIOJPTR which is application dependent - if you have issues with this I've been considering a change which would make this easier to do, so let me know if you have problems.

Cheers,

Doug.

--
You received this message because you are subscribed to the Google Groups "Runtime-Compiled C++" group.
To unsubscribe from this group and stop receiving emails from it, send an email to runtimecompiledcpl...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Not Sure

unread,
May 9, 2015, 6:48:01 AM5/9/15
to runtimecompi...@googlegroups.com
Thanks for reply, Doug!

Serialization is good, but I have a constraint -- I can't modify or overload openFrameworks classes, so I guess a global struct is the path of least resistance in my case. Though I think I will use serialization at some point for my personal code :)

Thanks again for the project, keep it up!
To unsubscribe from this group and stop receiving emails from it, send an email to runtimecompiledcplusplus+unsub...@googlegroups.com.

Doug Binks

unread,
May 9, 2015, 7:01:34 AM5/9/15
to runtimecompi...@googlegroups.com
You don't have to overload the camera object, you add a serialize function to the ofLiveApp and then serialize the camera in that.

To unsubscribe from this group and stop receiving emails from it, send an email to runtimecompiledcpl...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Runtime-Compiled C++" group.
To unsubscribe from this group and stop receiving emails from it, send an email to runtimecompiledcpl...@googlegroups.com.

Constantine

unread,
May 9, 2015, 7:10:47 AM5/9/15
to runtimecompi...@googlegroups.com
Oh, ok! So basically I should add Serialize function to ofLiveApp class and use SERIALIZE macro there at runtime?

You received this message because you are subscribed to a topic in the Google Groups "Runtime-Compiled C++" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/runtimecompiledcplusplus/qhtOEzohh-g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to runtimecompiledcpl...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
コンスタンティン・タラセンコフ
https://procedural.github.io

Doug Binks

unread,
May 9, 2015, 7:27:10 AM5/9/15
to runtimecompi...@googlegroups.com
Yes, you should use the SERIALIZE macro on each member variable of ofLiveApp to preserve state.

Constantine

unread,
May 9, 2015, 4:08:14 PM5/9/15
to runtimecompi...@googlegroups.com
Ok, I've tried to serialize, it does save the position of the camera and other attributes, but when linking happens the camera stops and mouse look isn't working. Maybe it's due to the fact that ofxAddons do these openFrameworks-specific listeners. Since they listen the methods by reference when swapping is done listeners may refer to the old references until they're not updated (like in my case, I have to disable and enable camera to make it work again). Is there a way to call object's constructors and destructors on their swap?

Constantine

unread,
May 9, 2015, 5:48:53 PM5/9/15
to runtimecompi...@googlegroups.com
Oh, it actually does call their constructors and destructors, apparently the addons which I use were not written with RCC++ in mind :) Anyway, thanks for answering the questions, Doug!

Constantine

unread,
May 9, 2015, 6:41:13 PM5/9/15
to runtimecompi...@googlegroups.com
Yeah, I fixed that and now we're talking! What a project, Doug! I can literally forget about compile button now

Doug Binks

unread,
May 10, 2015, 3:50:00 AM5/10/15
to runtimecompi...@googlegroups.com
Excellent, glad you have it working!
Reply all
Reply to author
Forward
0 new messages