Skip to content

Commit

Permalink
GL texture type and wrap defines now actually working
Browse files Browse the repository at this point in the history
  • Loading branch information
danomatika committed Sep 12, 2016
1 parent fdc8b55 commit b12cce0
Show file tree
Hide file tree
Showing 8 changed files with 296 additions and 494 deletions.
18 changes: 10 additions & 8 deletions luaExample/bin/data/scripts/boringTests.lua
Expand Up @@ -86,14 +86,13 @@ function setup()
img = of.Image()

-- GL type defines added by the swig interface (don't exist in OF)
local d = of.TEXTURE_CLAMP_TO_EDGE
d = of.TEXTURE_CLAMP_TO_BORDER
d = of.TEXTURE_MIRROR_REPEAT
d = of.TEXTURE_REPEAT

d = of.TEXTURE_LUMINENCE
d = of.TEXTURE_RGB
d = of.TEXTURE_RGBA
print("of.CLAMP_TO_EDGE: "..string.format("0x%X", of.CLAMP_TO_EDGE))
print("of.CLAMP_TO_BORDER: "..string.format("0x%X", of.CLAMP_TO_BORDER))
print("of.REPEAT: "..string.format("0x%X", of.REPEAT))
print("of.MIRRORED_REPEAT: "..string.format("0x%X", of.MIRRORED_REPEAT))
print("of.TEXTURE_LUMINANCE: "..string.format("0x%X", of.TEXTURE_LUMINANCE))
print("of.TEXTURE_RGB: "..string.format("0x%X", of.TEXTURE_RGB))
print("of.TEXTURE_RGBA: "..string.format("0x%X", of.TEXTURE_RGBA))

-- function loaded from separate script via require
requireTest()
Expand All @@ -105,6 +104,9 @@ function setup()
-- uint_64t
print("elapsed millis: "..of.getElapsedTimeMillis())

-- util stuff
of.restoreWorkingDirectoryToDefault()

end

function update()
Expand Down
2 changes: 1 addition & 1 deletion luaExample/src/ofApp.cpp
Expand Up @@ -157,7 +157,7 @@ void ofApp::prevScript() {
lua.doScript("variableTest.lua");

// prints global table if no table is pushed
//lua.printTable();
lua.printTable();

// print the variables in the script manually
ofLog() << "variableTest variables:";
Expand Down
232 changes: 78 additions & 154 deletions src/bindings/desktop/ofxLuaBindings.cpp

Large diffs are not rendered by default.

231 changes: 77 additions & 154 deletions src/bindings/ios/ofxLuaBindings.cpp

Large diffs are not rendered by default.

231 changes: 77 additions & 154 deletions src/bindings/linuxarm/ofxLuaBindings.cpp

Large diffs are not rendered by default.

73 changes: 52 additions & 21 deletions src/bindings/ofxLuaBindings.h
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.8
* Version 3.0.10
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
Expand Down Expand Up @@ -75,9 +75,11 @@
#endif

/* exporting methods */
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
# ifndef GCC_HASCLASSVISIBILITY
# define GCC_HASCLASSVISIBILITY
#if defined(__GNUC__)
# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
# ifndef GCC_HASCLASSVISIBILITY
# define GCC_HASCLASSVISIBILITY
# endif
# endif
#endif

Expand Down Expand Up @@ -642,16 +644,16 @@ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
char d = *(c++);
unsigned char uu;
if ((d >= '0') && (d <= '9'))
uu = ((d - '0') << 4);
uu = (unsigned char)((d - '0') << 4);
else if ((d >= 'a') && (d <= 'f'))
uu = ((d - ('a'-10)) << 4);
uu = (unsigned char)((d - ('a'-10)) << 4);
else
return (char *) 0;
d = *(c++);
if ((d >= '0') && (d <= '9'))
uu |= (d - '0');
uu |= (unsigned char)(d - '0');
else if ((d >= 'a') && (d <= 'f'))
uu |= (d - ('a'-10));
uu |= (unsigned char)(d - ('a'-10));
else
return (char *) 0;
*u = uu;
Expand Down Expand Up @@ -1526,6 +1528,44 @@ SWIGINTERN int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info * SWIGUNUSED
return result;
}

/* The class.get method helper, performs the lookup of class attributes.
* It returns an error code. Number of function return values is passed inside 'ret'.
* first_arg is not used in this function because function always has 2 arguments.
*/
SWIGINTERN int SWIG_Lua_class_do_get_item(lua_State *L, swig_type_info *type, int SWIGUNUSED first_arg, int *ret)
{
/* there should be 2 params passed in
(1) userdata (not the meta table)
(2) string name of the attribute
*/
int bases_search_result;
int substack_start = lua_gettop(L)-2;
assert(first_arg == substack_start+1);
lua_checkstack(L,5);
assert(lua_isuserdata(L,-2)); /* just in case */
lua_getmetatable(L,-2); /* get the meta table */
assert(lua_istable(L,-1)); /* just in case */
/* NEW: looks for the __getitem() fn
this is a user provided get fn */
SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
if (lua_iscfunction(L,-1)) /* if its there */
{ /* found it so call the fn & return its value */
lua_pushvalue(L,substack_start+1); /* the userdata */
lua_pushvalue(L,substack_start+2); /* the parameter */
lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */
lua_remove(L,-2); /* stack tidy, remove metatable */
if(ret) *ret = 1;
return SWIG_OK;
}
lua_pop(L,1);
/* Remove the metatable */
lua_pop(L,1);
/* Search in base classes */
bases_search_result = SWIG_Lua_iterate_bases(L,type,substack_start+1,SWIG_Lua_class_do_get_item,ret);
return bases_search_result; /* sorry not known */
}


/* The class.get method helper, performs the lookup of class attributes.
* It returns an error code. Number of function return values is passed inside 'ret'.
* first_arg is not used in this function because function always has 2 arguments.
Expand Down Expand Up @@ -1573,19 +1613,6 @@ SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SW
return SWIG_OK;
}
lua_pop(L,1); /* remove whatever was there */
/* NEW: looks for the __getitem() fn
this is a user provided get fn */
SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
if (lua_iscfunction(L,-1)) /* if its there */
{ /* found it so call the fn & return its value */
lua_pushvalue(L,substack_start+1); /* the userdata */
lua_pushvalue(L,substack_start+2); /* the parameter */
lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */
lua_remove(L,-2); /* stack tidy, remove metatable */
if(ret) *ret = 1;
return SWIG_OK;
}
lua_pop(L,1);
/* Remove the metatable */
lua_pop(L,1);
/* Search in base classes */
Expand All @@ -1612,6 +1639,10 @@ SWIGINTERN int SWIG_Lua_class_get(lua_State *L)
if(result == SWIG_OK)
return ret;

result = SWIG_Lua_class_do_get_item(L,type,1,&ret);
if(result == SWIG_OK)
return ret;

return 0;
}

Expand Down
1 change: 0 additions & 1 deletion src/ofxLua.cpp
Expand Up @@ -72,7 +72,6 @@ bool ofxLua::init(bool abortOnError, bool openLibs, bool ofBindings) {

return true;
}


void ofxLua::clear() {
if(L != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion swig
Submodule swig updated 1 files
+12 −9 openFrameworks.i

0 comments on commit b12cce0

Please sign in to comment.