<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Aashish,</div><div><br></div><div>I tried setting the value of the uniform but it isn't changing. I have been using the class vesKiwiImageWidgetRepresentation from the KiwiViewer code in my app for displaying brain volume data. I made a modification to it so that I can test setting this value on the uniform.</div><div>This code isn't working. The getter always returns 1. I placed breakpoints in this code and I have confirmed that it is finding the vertexOpacity uniform. Does it have to be a vesEngineUniform subclass in order to set its value? I noticed that the vesUniform class does not have the method bindRenderData</div><div><br></div><div><div>//----------------------------------------------------------------------------</div><div>void vesKiwiImageWidgetRepresentation::setPlaneOpacity(int planeIndex, double opacity)</div><div>{</div><div> assert(planeIndex >= 0 && planeIndex <= 2);</div><div><br></div><div> vesShaderProgram::Ptr shader = this->Internal->SliceReps[planeIndex]->actor()->material()->shaderProgram();</div><div> vesUniform::Ptr uniform = shader->uniform("vertexOpacity");</div><div><br></div><div> uniform->set( (float) opacity);</div><div> shader->updateUniforms();</div><div>}</div><div><br></div><div>//----------------------------------------------------------------------------</div><div>double vesKiwiImageWidgetRepresentation::planeOpacity(int planeIndex)</div><div>{</div><div> assert(planeIndex >= 0 && planeIndex <= 2);</div><div><br></div><div> float value = 0;</div><div><br></div><div> vesShaderProgram::Ptr shader = this->Internal->SliceReps[planeIndex]->actor()->material()->shaderProgram();</div><div> vesUniform::Ptr uniform = shader->uniform("vertexOpacity");</div><div><br></div><div> uniform->get(value);</div><div><br></div><div> return value;</div><div>}</div></div><div><br></div><div><br></div>Thanks -<br><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Jon Chmura</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><a href="mailto:jon.chmura@me.com">jon.chmura@me.com</a></div><div><br></div></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br><div><div>On Oct 15, 2013, at 10:02 AM, Aashish Chaudhary <<a href="mailto:aashish.chaudhary@kitware.com">aashish.chaudhary@kitware.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi Jon, <div><br></div><div>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. </div><div>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. </div>
<div><br></div><div>- Aashish</div><div><br></div><div><b>In vesShaderProgram.cpp</b></div><div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">this</span><span style="">-></span><span style="">addUniform</span><span style="">(</span><span style="color:rgb(128,0,128)">vesVertexOpacityUniform</span><span style="">::</span><span style="color:rgb(128,0,128)">Ptr</span><span style="">(</span><span style="color:rgb(128,128,0)">new</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vesVertexOpacityUniform</span><span style="">));</span></pre>
</div><div><br></div><div><b>in vesEngineUniform.h</b></div><div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">class</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vesVertexOpacityUniform</span><span style="color:rgb(192,192,192)"> </span><span style="">:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">public</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vesUniform</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">public</span><span style="">:</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">vesTypeMacro</span><span style="">(</span><span style="color:rgb(128,0,128)">vesVertexOpacityUniform</span><span style="">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vesVertexOpacityUniform</span><span style="">(</span><span style="color:rgb(128,128,0)">const</span><span style="color:rgb(192,192,192)"> </span>std<span style="">::</span>string<span style="color:rgb(192,192,192)"> </span><span style="">&</span><span style="">name</span><span style="">=</span><span style="color:rgb(0,128,0)">"vertexOpacity"</span><span style="">)</span><span style="color:rgb(192,192,192)"> </span><span style="">:</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vesUniform</span><span style="">(</span><span style="">name</span><span style="">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">static_cast</span><span style=""><</span><span style="color:rgb(128,128,0)">float</span><span style="">>(</span><span style="color:rgb(0,0,128)">1.0</span><span style="">))</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">virtual</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">void</span><span style="color:rgb(192,192,192)"> </span><span style="font-style: italic; ">update</span><span style="">(</span><span style="color:rgb(128,128,0)">const</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vesRenderState</span><span style="color:rgb(192,192,192)"> </span><span style="">&</span><span style="">renderState</span><span style="">,</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">const</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vesShaderProgram</span><span style="color:rgb(192,192,192)"> </span><span style="">&</span><span style="">program</span><span style="">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">vesNotUsed</span><span style="">(</span><span style="">program</span><span style="">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">this</span><span style="">-></span><span style="">set</span><span style="">(</span><span style="">renderState</span><span style="">.</span><span style="color:rgb(128,0,0)">m_mapper</span><span style="">-></span>color<span style="">()[</span><span style="color:rgb(0,0,128)">3</span><span style="">]);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="">};</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style=""><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="">I have to remember (or find out) why we didn't derive from vesEngineUniform for opacity, but that shouldn't really affect you. </span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style=""><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="">- Aashish</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style=""><br>
</span></pre></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 14, 2013 at 4:24 PM, Aashish Chaudhary <span dir="ltr"><<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear Jon, <div><br></div><div>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, </div>
<div>you are bounds of engine uniforms. </div>
<div><br></div><div>I thought we have an API for the engine uniforms, let me make a check on it. </div><div><br></div><div>Thanks,</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div>
<div class="h5">On Mon, Oct 14, 2013 at 2:58 PM, Jon Chmura <span dir="ltr"><<a href="mailto:jon.chmura@me.com" target="_blank">jon.chmura@me.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div style="word-wrap:break-word"><div>I want to set the value of vertexOpacity in vesGourandTexture shader program.</div>
<div><br></div><div><div>/// \file vesGouraudTexture_frag.glsl</div><div>///</div><div>/// \ingroup shaders</div><div><br></div><div>uniform lowp float vertexOpacity;</div><div><br></div></div><div>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.</div>
<span><font color="#888888"><div><br></div><div>
<div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-wrap:break-word;word-spacing:0px">
Jon Chmura</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-wrap:break-word;word-spacing:0px">
<div><a href="mailto:jon.chmura@me.com" target="_blank">jon.chmura@me.com</a></div><div><br></div></div><br><br>
</div>
<br></font></span></div><br></div></div>_______________________________________________<br>
Ves mailing list<br>
<a href="mailto:Ves@public.kitware.com" target="_blank">Ves@public.kitware.com</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/ves" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/ves</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br>| Aashish Chaudhary <br>| R&D Engineer <br>| Kitware Inc. <br>| <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>| Aashish Chaudhary <br>| R&D Engineer <br>| Kitware Inc. <br>| <a href="http://www.kitware.com/">www.kitware.com</a>
</div>
</blockquote></div><br></body></html>