SFSL, otherwise known as Simple Fast Shading Language, will make writing, compiling, and implementing OpenGL Shading Language(GLSL), into your C or C++ program easier than ever! When completed I will post the source & binaries download locations, for everyone to use freely. Currently, I can only offer an example as to how one might use this in its most simplest form. Which you'll see below.
SFSL Example
vec4 Color;
void myVertexShader()
{
gl_Vertex = gl_ModelViewProjectionMatrix * gl_Vertex;
}
void myFragmentShader()
{
gl_FragColor = Color;
}
// requires at least 1 material
material ExampleMaterial
{
// optional material booleans
AlphaEnabled = true;
// required material functions
VertexShader = myVertexShader();
FragmentShader = myFragmentShader();
}
C++ Example
sfsl::Shader myShader;
void initialize()
{
// load our shader from file
if(!myShader.LoadFromFile("example_shader.sfsl"))
{
std::cerr << sfsl::IO::GetLastError() << std::endl;
return;
}
}
....
void render()
{
// this will automatically get the last called material ( or first material ), unless a name is specified
sfsl::Material myMaterial = myShader.GetMaterial();
// enable the shader
myShader.Enable();
myMaterial.Enable();
// set our color property to red
float myColor[4] = { 1, 0, 0, 1 };
myMaterial.SetProperty("Color", myColor);
// draw the triangle
glBegin(GL_TRIANGLE);
glVertex3f(0, 0, 0);
glVertex3f(1, 0, 0);
glVertex3f(1, 1, 0);
glEnd();
// and disable the last called material ( or specify which one to disable by its name )
myMaterial.Disable();
// disable the shader
myShader.Disable();
}
[/code]