[clutter] Doubts about clutter_shader_bind

From: ere wer <garfieldhq_at_yahoo.com>
Date: Wed, 2 Apr 2008 13:51:53 -0700 (PDT)

I spend a large portion of the day studding the base actor class (5600+ lines of code, wow :)), and more specifically, the rendering.

And one thing drew my attention - the shader compiling/binding/linking part.
I spend about an hour looking for that, first in the actor, than in cogl, even in the backend until I finally found it in well...the shader files.
I know it might looks obvious, but it is not to obvious in practice, because traditionally that phase is handled by OpenGL API and compiling/binding/linking itself does not have anything to do with the shaders themselves. Even more so, the bind_shader function in Clutter right now is composed entirely of cogl calls. My guess is that the function is not in the cogl code simply because it has to be exposed without the need of cogl to be included, and that is perfectly reasonable (though it could be exposed through Actor like clutter_actor_set_shader_param )...

...But my main point is - do we really need clutter_shader_bind to be exposed at all. Its very very low level function (much like glBlend or glStencilFunc or whatever) and makes sense only to graphic programmers (not the casual Clutter users) and only in the actual drawing context, not in the top level scene creation/management stage. Because of this it is not obvious that the function must be called at all, and even if the user does know, there is no way of telling when it is to be called (after or before setting the params? or calling actor_show? or actor_set_shader?) Even what actor does it effect is not clear from the statement itself.
In the end, from end user perspective , actor_set_shader should be enough: Its sets some "property" on my actor, that changes the way it looks. Just like set_size or set_position.

.
I can image how annoying this kind of mails for the team are, neither bug report nor feature request, and how terribly wrong I can be, but I decided to share my thoughts after all :)
 I`ll be happy to hear your comments, 10x.
MihailNaydenov

PS In the test-shader example, is it really necessary to call clutter_actor_set_shader (<actor>, NULL), which destroys the previously set shader, before setting a new one? Looking at the set_shader code, its seams not only unnecessary, but even faster if you call it the second time because it skips the creation of the params hashtable.

      ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

-- 
To unsubscribe send a mail to clutter+unsubscribe_at_o-hand.com
Received on Wed Apr 02 2008 - 16:51:53 EDT

This archive was generated by hypermail 2.2.0 : Wed Apr 02 2008 - 17:00:51 EDT