Closed fredreichbier closed 7 years ago
They are wrapped, just using a diff name: https://github.com/danomatika/swig-openframeworks/blob/master/openFrameworks.i#L232
Do you think it's better call them with the same name? Though they will still be module level enums:
of.GL_LUMINANCE
of.GL_RGB
of.GL_RGBA
Sorry, didn't word that very well. If I understand correctly, of.TEXTURE_RGB
should evaluate to 0x1907
if all goes well. But if I add a print d
right here, I just get nil
. There is also no mention of TEXTURE_RGB
in the SWIG-generated code. Could it be that swig just ignores the lines you linked?
Yeah, good catch. I'm including the defines but I think SWIG doesn't actually know about the defines in the GL headers, so it doesn't actually set the values.
Confirming the existing values aren't set:
[notice ] got a script error: Error running setup(): ...ddons/ofxLua/luaExample/bin/data/scripts/boringTests.lua:109: attempt to concatenate a nil value (field 'TEXTURE_LUMINANCE')
Ah, alright. I guess it would also be cool if more GL constants were exported, as I've already patched my local ofxLua to export GL_FRAGMENT_SHADER
to Lua as well. But I'm not sure what's the best approach to do that.
My approach is to wrap just the things that are needed, otherwise we end up going down the road of wrapping the whole gl API. There are lua modules that already do that. That being said, does ofShader need the GL shader defines as well?
Sorry for the silence on my part. I see that you wrapped LUMINANCE
, RGB
and RGBA
in baa07cfd -- thank you for that! So I guess this pull request is obsolete now. I just opened a new pull request (#10) for GL_FRAGMENT_SHADER
.
Stumbled upon ofxLua, great project! For some reason, the three constants were not available on the Lua side for me. I don't know much about SWIG, but I can access them in Lua if I use the
%constant
instead of#define
to wrap them. Maybe you know a better way though.Cheers!