ofxLua

I’ve updated ofxLua to use Semantic Versioning. There is now a changelog and ofxLua-specific version tags to replace the previous tags which were based on OF versions.

@lewislepton and @yeswecan, y’all might be interested in loaf (lua, oscillator, and openFrameworks) which I just released today: http://www.danomatika.com/code/loaf

ofxLua 1.3.0 (& 1.3.1 shortly after) is now out. See the changelog for details.

Main info:

1.3.0

  • updated for OF 0.10
  • build error and bug fixes
  • fleshed out documentation commenting

1.3.1

  • added glm library bindings

Wow Dan, thanks again for your amazing work.

I have a small conversion issues with the last release with XCode

Line 42883 :
SWIG_fail_ptr(“Xml_getAttributes”,1,SWIGTYPE_p_ofXml);

Hi Dan,

I’m trying to compile the luaExample on Linux.
I get many instances of these bugs:

/home/edward/software/of/of_v0.10.1_linux64gcc6_release/addons/ofxLua/src/bindings/desktop/ofBindings.cpp:5646:37: note: in expansion of macro ‘SWIG_contract_assert’
arg3 = (GLint)lua_tonumber(L, 3); SWIG_contract_assert((lua_tonumber(L,4)>=0),“number must not be negative”)

/home/edward/software/of/of_v0.10.1_linux64gcc6_release/addons/ofxLua/src/bindings/desktop/ofBindings.cpp:5647:38: note: …this statement, but the latter is misleadingly indented as if it is guarded by the ‘else’
arg4 = (GLenum)lua_tonumber(L, 4); (arg1)->createAndAttachDepthStencilTexture(arg2,arg3,arg4); return SWIG_arg;

/home/edward/software/of/of_v0.10.1_linux64gcc6_release/addons/ofxLua/src/bindings/desktop/ofBindings.cpp:5865:43: note: …this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
if (arg1) (arg1)->textureTarget = arg2; return SWIG_arg; if(0) SWIG_fail; fail: lua_error(L); return SWIG_arg; }

This all looks like issues with SWIG. I note you stated: “This branch is fully working and tested on OS X and iOS. It should work pretty easily on Win and Linux now that Boost isn’t required”

i was able to make it work on linux, but you have to regenerate the bindings:

cd ofxLua
git submodule init
git submodule update
cd scripts
./generate_bindings.sh

Thanks! It works.
Nwo I just have to find a way of using framebuffers that don’t crash, but that’s another topic…
Cheers

UPDATE: rolling this back a bit for now. See next post.

ofxLua 1.4.3 is now out. See the changelog for details.

Since my last post here, versions 1.3.2 - 1.3.7 and 1.4.0 - 1.4.2 have also been released.

Main info:

  • OF 0.11 support (ofxLua 1.4.0)
  • OF 0.10.1 support (ofxLua 1.3.6)
  • updated to Lua 5.4.2 Lua 5.3.6
  • added basic Android support and info on how to build ofxLua with Android Studio
  • general bindings updates

Whoops, I noticed a few issues and am rolling back the ofxLua 1.4.3 release for now to address them. The Lua version will also now be 5.3.6 instead of 5.4.2.

Ok, now ofxLua 1.4.3 is out. See the changelog for details.

Main info:

  • OF 0.11 support (ofxLua 1.4.0)
  • OF 0.10.1 support (ofxLua 1.3.6)
  • updated to Lua 5.3.6
  • added basic Android support and info on how to build ofxLua with Android Studio
  • added info about building Lua modules, module.mk helper script, and example
  • general bindings updates

Happy Holidays!

1 Like

Hello!

Does anyone have a basic example of doing a shader in ofxLua?

(i’m not quite getting the hang of it so far)

Hi,
Haven’t done this myself, but saw this post / example which has a simple shader implementation:

does not look like it’s using ofxLua tho… but maybe it’ll give me some ideas. :slight_smile:

Ah, now I see. I thought I recognized Lua, and therefore ofxLua, which isn’t the case :wink:

1 Like

Shaders should work fine. The main difference is that the ofShader begin() and end() member functions are renamed to beginShader() and endShader() as end is a reserved Lua keyword.

As noted in the (basic) wrapper overview in the ofxLua readme, this is also true for other classes which use begin() and end() such as ofFbo.

UDPATE: You can see a full listing of the Lua of module functions and variables generated for my loaf (Lua Osc And openFrameworks) interpreter: https://github.com/danomatika/loaf/blob/master/doc/modules/of_syntax.txt

1 Like

Right right.

I was kinda confused because the various shader examples I was finding were including the shader as a separate file.

Gonna save that function list for perusing later :slight_smile:

Well, you still need the shader as separate files written in GLSL.

1 Like

Can those be included from the local lua filepath (if it’s different from the oF app filepath)?

Have a use-case where the user is just interacting with the lua files and the oF app and its data are in a separate location - so creating a lua script that depends on a shader can get confusing for install process

When loading a script, you can change the working directory: https://github.com/danomatika/ofxLua#lua-require

It basically calls chdir() for you but leaves the ofDataPath alone.

In that case, load resources from the main data path first or save the datapath & append it manually later.

Then for script resources, change the datapath before loading the script. Calling chdir() is really only needed for Lua to find other Lua scripts or libs.

1 Like