Original Post
I''m thinking of using a pluggable dll system for my shaders/materials and just wanted to run my design past you guys.
The shader dll exports a function which sets up all the applicable states required to obtain the effect. The only problem with this is that the dll doesn''t know what the curent set of states is. I am therefore thinking of passing a structure containing the current states of the renderer. Although my renderer is designed to be pluggable for different API''s I feel that the shader''s need to have a different function for each API, because of the possible different states in the renderer.
My basic rendering loop then becomes:
Call shader function(from dll, although some simple shaders could be in the renderer code itself, just use function pointers)
for(each object that uses shader)
Setup vertex arrays.
Bind textures
Render geometry using index array.
