[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Using Lua for OpenGL Shaders
- From: Wesley Smith <wesley.hoke@...>
- Date: Mon, 26 Apr 2010 09:20:52 -0700
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