[Ves] Modify uniform variables
Aashish Chaudhary
aashish.chaudhary at kitware.com
Tue Oct 15 10:02:40 EDT 2013
Hi Jon,
Please have a look at the class below. You can create a new instance of it
(give it a different name) and you should be able to change its value.
Looking at the code, the opacity uniform is not an engine uniform (engine
uniforms are special uniforms), so you can even get it and then change its
value if needed.
- Aashish
*In vesShaderProgram.cpp*
this->addUniform(vesVertexOpacityUniform::Ptr(new vesVertexOpacityUniform));
*in vesEngineUniform.h*
class vesVertexOpacityUniform : public vesUniform
{
public:
vesTypeMacro(vesVertexOpacityUniform);
vesVertexOpacityUniform(const std::string &name="vertexOpacity") :
vesUniform(name, static_cast<float>(1.0))
{
}
virtual void update(const vesRenderState &renderState,
const vesShaderProgram &program)
{
vesNotUsed(program);
this->set(renderState.m_mapper->color()[3]);
}
};
I have to remember (or find out) why we didn't derive from
vesEngineUniform for opacity, but that shouldn't really affect you.
- Aashish
On Mon, Oct 14, 2013 at 4:24 PM, Aashish Chaudhary <
aashish.chaudhary at kitware.com> wrote:
> Dear Jon,
>
> Let me have a look at the code and will reply back. But in short, you can
> make your own uniform and use that in the shader, IN other words,
> you are bounds of engine uniforms.
>
> I thought we have an API for the engine uniforms, let me make a check on
> it.
>
> Thanks,
>
>
>
> On Mon, Oct 14, 2013 at 2:58 PM, Jon Chmura <jon.chmura at me.com> wrote:
>
>> I want to set the value of vertexOpacity in vesGourandTexture shader
>> program.
>>
>> /// \file vesGouraudTexture_frag.glsl
>> ///
>> /// \ingroup shaders
>>
>> uniform lowp float vertexOpacity;
>>
>> It is given a default value of 1 in vesEngineUniform. But I can't find
>> any accessors for it as there are for point size, line width, etc.
>>
>> Jon Chmura
>> jon.chmura at me.com
>>
>>
>>
>>
>>
>> _______________________________________________
>> Ves mailing list
>> Ves at public.kitware.com
>> http://public.kitware.com/cgi-bin/mailman/listinfo/ves
>>
>>
>
>
> --
> | Aashish Chaudhary
> | R&D Engineer
> | Kitware Inc.
> | www.kitware.com
>
--
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ves/attachments/20131015/e7bf98ea/attachment-0001.html>
More information about the Ves
mailing list