Re: [osg-users] Reason why not to change the name of a Uniform?

2013-12-03 Thread Robert Osfield
Hi Johannes,

A Uniform is not meant to change it's name or type through the life of an
application as the shaders that they are associated with will also normally
be invariant through the lifetime of the application.

If you want a Uniform to have a different name or type it's essentially now
a different Uniform and has a different mapping the shaders it is
associated with.

For changing Uniform name or type mid way through an application means that
the Shader's it's assoicated with are also changing which really doesn't
suggest that the we are talking about different Uniforms and Shaders but in
your case you don't want to both creating new ones that map this logic,
instead want to reuse.  Creating new Uniform and Shaders when you have new
uniforms and shaders seems logical to me.

Robert.


On 3 December 2013 10:07, Johannes Scholz  wrote:

> Hi,
>
> in our application we just created an user interface for setting up
> osg::Uniform data on our nodes for 'artist usage' (setting shader input
> values like colors or textures).
>
> Now I encountered that the uniform name must not be changed which is from
> a artist user perspective quite inconvenient.
>
> As I expect this to be intended for some reason I will make a workaround
> copying the uniform adding it with a new name.
>
> But could somebody explain me what was the reason for the decision making
> the uniform name not changeable?
>
> Thank you!
>
> Cheers,
> Johannes
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=57529#57529
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Reason why not to change the name of a Uniform?

2013-12-08 Thread Johannes Scholz
Hi Robert,

thanks for your answer. I agree with you for most applications.

Now the thing is, we are currently adding a simple text-based Shader Editor in 
our application. So while writing the shader the developer will change uniform 
names almost for certain. Now the developer will not understand why to create a 
new uniform having the same values when one would expect a rename feature like 
let's say in RenderMonkey.

But as said, I will work around it, internally copying the data of the uniform 
when "Rename" is requested from our User Interface.

 
Thank you!

Cheers,
Johannes

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=57603#57603





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Reason why not to change the name of a Uniform?

2013-12-09 Thread Jan Ciger
Hello Johannes,

On Sun, Dec 8, 2013 at 10:06 PM, Johannes Scholz wrote:

> Hi Robert,
>
> thanks for your answer. I agree with you for most applications.
>
> Now the thing is, we are currently adding a simple text-based Shader
> Editor in our application. So while writing the shader the developer will
> change uniform names almost for certain. Now the developer will not
> understand why to create a new uniform having the same values when one
> would expect a rename feature like let's say in RenderMonkey.
>
> But as said, I will work around it, internally copying the data of the
> uniform when "Rename" is requested from our User Interface.
>


In my opinion, if you are building an editor, you shouldn't rely on the
scenegraph that is used to preview your shaders as the primary data storage
solution. You should keep your own internal data structures that allow you
to make an efficient UI and then generate the scenegraph from that for
preview. In that case the entire problem with uniforms wouldn't even arise,
because you would be creating a new object, not renaming an old one.

OSG cannot really rename an uniform, because the OpenGL API doesn't have
that feature neither. You can only create one or delete it. What you are
basically asking for is that OSG internally creates a new object with a new
name for you, copy the data and delete the old one, while pretending that
it is renaming the old one - essentially implementing some logic that makes
sense only for UI, not for OpenGL.

J.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org