lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Apr 26, 2010 at 9:43 AM, Joe Andresen <joe.andresen@gmail.com> wrote:
> This is very interesting, but if i were to use this i would need a way of
> coupling the input of a shader with the actual shader. the shader code
> itself is half the battle.

Sure.  I'm not exactly sure what you mean by actual shader (C++
object, GLSL shader object ID, ....? ).  Here's the C++ class
implementation that interfaces with shader definitions I posted
before:

http://www.mat.ucsb.edu/projects/luaAV/browser/branches/luaav3/modules/Muro/src/glo/Shader.cpp

There are a number of other files that do the actual GLSL work and
some more that provide bindings from C++ to Lua itself.  It ends up
looking like

local mtl = Shader{
    ctx = context_name,
file = file_to_shader,
param = {
param1 = val1,
param2 = val2,
}
}


function draw()
mtl:bind()
-- draw
mtl:unbind()
end

wes