Got distracted writing the presentation this evening. I wanted a simple set of examples of shader usage, particularly with respect to replacing fixed-function pipeline operations (there's a number of partial solutions in the various OpenGL books I have on my bookshelf, but I haven't found anything that looks like a complete reimplementation, though there are references that it might be in the latest version of the formal spec or the like). That's actually toward the end of the presentation, but I somehow jumped down there this evening...
Maybe it was because the shader demo code was crashing on the nVidia workstation (but not the ATI laptop) due to creating shaders outside the context (fixed now). Somehow as I was working on that I might have thought "oh, I'll just implement Shader nodes for VRML97 in OpenGLContext" so that people can type in a shader and see it update live in their world.
Problem is, the X3D programable shader spec isn't really VRML97 compatible, as it would require new syntax (you have to be able to define new fields for individual nodes to use it). I did briefly toy with the idea (again) of implementing all of X3D, but came solidly down on the "not tonight" side on that one. So I wound up rolling my own for now where Uniforms are declared as nodes. Not happy with that solution (I like the idea of routing as setting, but really the routed values should be matrices/vectors, rather than MFFloat/MFInt types, which means extending the pyvrml97 model again). Luckily I didn't actually implement the uniforms yet, so I can change my mind :) .
I'm currently only allowing for GLSL shaders. Cg or low-level shaders should fit into the scheme easily (as with X3D, you specify the shaders in preference order, and the first one that has an implementation available is the one that gets used), but they're not high on the priority list. Also doing some tracing with OpenGL.FULL_LOGGING (really is very handy for tracking down crashes and the like), that pointed out that OpenGLContext could use some more optimization, it's doing a lot of extraneous state-modifications "just to be sure".
Maybe the mad idea that, lead me down the garden path into implementing shader nodes was the idea of implementing the Appearance/Material nodes with auto-generated Shader nodes. That would, when combined with the VBO IFS compiler mean you could almost eliminate the fixed-function pipeline in OpenGLContext today... if today hadn't gotten away from me, that is. I also briefly toyed with adding multi-texture support this evening... it's one of the things that should have been done ages ago...So maybe I was just procrastinating. I want to have both presentations to rough-draft stage this week, but some part of me wants to play with the stuff instead of writing about playing with it :) .
Pingbacks are closed.