Vertex/Fragment Program State

I’ve got a special request regarding the handling of some render state.

Actually, only the vertex/Fragment program render state…



The fact is, some of these shaders need to be set accordingly to the specific mesh on which they’re applied, use of local parameter in the ARB.



I will speak of mesh in general i.e. TriMesh, Line, Point, Curve, etc.



I was first thinking of making a inherited version of the VertexProgramState that will be set according to the mesh on whish it currently apply using controllers’ feature. But controllers are all called before any rendering, doing so, the last controller set the VertexProgramState.



Furthermore, if not using the invariance property of ARB program, one may need to retrieve some specific OpenGL state just before the mesh is renderer, like ModelViewMatrix, etc. that are set just before mesh rendering.



That brings in my mind : why doon’t put all these preprocessing in a unique method, rather than duplicate in all rendering methods.

I’m thinking of another thing : the duplicate and non-synchronized code in the TriMesh rendering code and in the CloneNode method.

I don’t want to bugs you :// I’ve just bring back the old port to JOGL i’ve started several month ago, when i’ve seen that. I’m planning to update it and try to finish it, but that’s an other point i won’t speak any more since nothing is really done yet.





Go back, to my first request : add a render Controller feature. just like other controllers, but these are called just before rendering by the renderer. Actually, this would also provide a way to handle multi-pass rendering. I’m thinking during i’m writing these lines, so forget any bad ideas.

such controller should not be called all before rendering but with a loop like :



setWorldTransform(mesh) // set world Translation, rotation and scale…



for all controller in mesh.controllers {

controller.update()

render(mesh) // in fact actual mesh specific drawing

// such as glDrawElement(…)

}



by default, controllers should contain a controller that follow the Null Object pattern, that is whose update method does actually NOTHING.

If controllers size is greater tha one, a lock on Vertex array buffer could be used for performance issue. Since i don’t actually know, if one can still modify vertex coordinate in pipeline (vertex program) when doing so…



ok nothing is mature there, only idea :wink:





For those that may ask, i’ve stoped my port to JOGL since i’ve seen, that i need also a Jinpunt and a JOAL port. so the relative small rendering deal become an input and sound big deal :frowning: … for which i’ve no knowledge. but i’ll try slowly, as often as i’ve some time for it :smiley: .