With the new C++ 11 standard, we would like to see GLSL adopt the C++ standard and introduce classes to the shading language. I can think of many useful applications. One is representing a fragment by a class. For example:
class MyFragment
{
void SetColor(...);
void SetPosition(...);
Color color;
};
This way we can direct the fragment to any location or even generate other fragments, as I suggested before.
std::list<MyFragment> frags = frag.Clone(4);
frags[0].SetPosition(...);
frags[1].SetPosition(...);
frags[2].SetPosition(...);
frags[3].SetPosition(...);
I think OO is the way to go in shaders and it will solve many problems. For now make it an extension:
GL_ARB_cpp11withSTL_glsl




