[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Cg, GLSL and uniform parameters



Heya people,


I'm currently planning the addition of programmable vertex and pixel shaders into my engine and I'm a bit puzzled with some parts of the process.

My most important problem right now is figuring out how to manage uniform parameters for GPU programs. nVidia's Cg Runtime API offers some neat functionalities for this, plus it has the advantage of being able to compile programs on the fly for various profiles. Thing is, the engine supports OpenGL exclusively, so I have spent some time reading and learning about the OpenGL Shading Language also. In the process I've noted that the API functionality that comes with the ARB_shader_objects extension also promotes easy ways to manipulate uniform parameters and stuff.

If I use Cg and want to be able to support various profiles without writing specific shaders for each one, I can't really go ahead and use some of the facilities of the ARB_vertex_program and ARB_fragment_program extensions, which allow direct access to OpenGL states, just like GLSL. For what I have seen until now, most uniform parameters defined in shaders correspond to OpenGL states anyway, so I could save some trouble by working directly with GLSL or exclusively with versions (present and future) of ARB_vertex_program and ARB_fragment_program.

Do you think it would be worth working with Cg and allowing a little more flexibility, though having some more trouble coding management for generic uniform parameters, or should I stick with options that allow direct access to OpenGL states (GLSL and ARB_vertex/fragment_program) and save myself some trouble?



Thank you for your attention,
Miguel A. Osorio.