lua-users home
lua-l archive

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


I've been using Lua to manage GLSL files for a while as well.  For my
needs, I wanted the files to have a more data description feel, which
Lua does nicely.  The functions in the file end up calling into C++
with the entire file returning a C++ object representing a shader.
Here's what a Lua file looks like:

http://www.mat.ucsb.edu/projects/luaAV/browser/branches/luaav3/extra/resources/shaders/material/mat.phong.shl

Shader{
	name = "mat.phong.shl",
	description = [[ per-pixel lighting model ]],
	language = "GLSL",
	
	parameters = {
		Parameter {
			{0., 0., 0., 1.},
			name = "La", type = "vec4",
			description = "ambient light",
		},

.... continues ....

For handling GLSL 120 v. 130, I would probably add a version field to
the description.  Anyway, hope this provides food for thought.  Thanks
for the article!

wes