danomatika / ofxLua

(maintained) a lua scripting interface & bindings for openFrameworks
Other
164 stars 36 forks source link

Problem adding vertex to mesh #60

Closed owenosborn closed 4 years ago

owenosborn commented 4 years ago

When I run the following:

local mesh = of.Mesh()
mesh:setMode(of.PRIMITIVE_POINTS)
local top = glm.vec3(100.0, 50.0, 0.0)
mesh:addVertex(top)

I get this error:

Error in Mesh_addVertex (arg 2), expected 'ofDefaultVertexType *' got 'glm::vec3 *'

Same thing if I use of.Vec3f() for the vertex...Anything to try from lua end? or is this a problem with the bindings?

danomatika commented 4 years ago

Hmmm. Strange. It works fine for me on macOS. What versions of OF & ofxLua are you using.

This runs without errors in the luaTests test script:

  local mesh = of.Mesh()
  mesh:addVertex(glm.vec3(1, 2, 3))
  mesh:setMode(of.PRIMITIVE_POINTS)
  local top = glm.vec3(100.0, 50.0, 0.0)
  mesh:addVertex(top)
owenosborn commented 4 years ago

I'm running linuxarm (Raspberry Pi). OF 0.10.1, ofxLua 1.3.3

Yeah, getting same error out of the test.

tests.lua:71: Error in Mesh_addVertex (arg 2), expected 'ofDefaultVertexType *' got 'glm::vec3 *'
danomatika commented 4 years ago

It a bindings issue were Swig needed to know about the ofDefaultVertexType and is fixed in ofxLua 1.3.6. You can update to 1.3.7 which has bindings for OF 0.10, see the change log.

owenosborn commented 4 years ago

I can confirm this now works with latest versions of OF and ofxLua. Thanks