Hi all.

>From my experience with shaders, you get this error when you have setting a
uniform which is not declared _nor_ used in the shader. The glsl-compiler, at
least for nvidia, then optimizes away that parameter, so when setting it, you
get an error.

Looking at your shaders, you are trying to modify a uniform? (Thats not right,
use a varying for that) And it is not declared uniform in the fragment shader?
Be consistent. And, make sure you actually use that uniform somewhere.

Hope it helps.
/Marcus


Quoting Andreas Zieringer <[EMAIL PROTECTED]>:

> Hi Oliver,
> 
> hmm really strange never had such a problem. Just looked into the code
> 
> GLint location = getUniformLocation(program, p->getName().c_str());
> if(location != -1)
>      uniform1i(location, (GLint) p->getValue());
> else
>      FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
> 
> can't see any reason why this shouldn't work. Can you write out your 
> scene as a osb file and send it to me? Perhaps it is a opengl driver 
> problem?
> 
> Andreas
> 
> > Hi all,
> > 
> > I have a very strange problem with my glsl shader and the 
> > setUniformParameter function. I have two shader chunks and every chunk 
> > gets the same parameters and the two fragment shaders are nearly the 
> > same. Here is how I set up the parameters:
> > 
> > // -------->
> > 
> > // first shader chunk
> > beginEditCP(_shlChunkNVP); {
> >   _shlChunkNVP->readFragmentProgram("shader/particles_nvp.frag");
> >   _shlChunkNVP->setUniformParameter("scale", _fScale);
> >   _shlChunkNVP->setUniformParameter("loga", _bLoga);
> > 
> >   if (state == DYNAMIC) {
> >      _shlChunkNVP->setUniformParameter("dynamic", true);
> >      _shlChunkNVP->setUniformParameter("ipVal", _fIpVal);
> >   }
> >   else {
> >      _shlChunkNVP->setUniformParameter("dynamic", false);
> >      _shlChunkNVP->setUniformParameter("ipVal", 0.0f);
> >   }
> > } endEditCP(_shlChunkNVP);
> > 
> > // second shader chunk
> > beginEditCP(_shlChunkFBODir); {
> >   _shlChunkFBODir->readFragmentProgram("shader/particles_fbo_dir.frag");
> >   _shlChunkFBODir->setUniformParameter("scale", _fScale);
> >   _shlChunkFBODir->setUniformParameter("loga", _bLoga);
> > 
> >   if (state == DYNAMIC) {
> >      _shlChunkFBODir->setUniformParameter("dynamic", true);
> >      _shlChunkFBODir->setUniformParameter("ipVal", _fIpVal);
> >   }
> >   else {
> >      _shlChunkFBODir->setUniformParameter("dynamic", false);
> >      _shlChunkFBODir->setUniformParameter("ipVal", 0.0f);
> >   }
> > } endEditCP(_shlChunkFBODir);
> > 
> > // <--------
> > 
> > But I get an error while runtime.
> > WARNING: Unknown parameter 'dynamic'!
> > and this is for the second chunk and I don't know why. The other 
> > parameters are also correct. And the parameters are marked as uniform in 
> > the shader (these entries are the same in both fragment programs):
> > 
> > // -------->
> > 
> > uniform bool  dynamic;
> > uniform bool  loga;
> > uniform float ipVal;
> > uniform float scale;
> > 
> > // <--------
> > 
> > The funny thing is, when I change the type from bool to float (in shader 
> > and program), it is the same. When I change the name in both files, it 
> > is the same. I have an ugly workaround, but it would be nice to have it 
> > correctly:
> > 
> > // -------->
> > 
> > if (state == DYNAMIC) {
> >   _shlChunkFBODir->setUniformParameter("params", Vec2f (1.0f,1.0f));
> >   _shlChunkFBODir->setUniformParameter("ipVal", _fIpVal);
> > }
> > else {
> >   _shlChunkFBODir->setUniformParameter("params", Vec2f (0.0f,0.0f));
> >   _shlChunkFBODir->setUniformParameter("ipVal", 0.0f);
> > }
> > 
> > // <--------
> > 
> > and in the shader:
> > 
> > // -------->
> > 
> > uniform vec2 params;
> > bool dynamic;
> > 
> > void main(void) {
> >   if (params.x == 0) dynamic = false;
> >   else dynamic = true;
> >   ...
> > }
> > 
> > // <--------
> > 
> > I wonder, if anyone has an idea?
> > 
> > regards,
> > Oliver
> > 
> > 
> > -------------------------------------------------------
> > This SF.Net email is sponsored by the JBoss Inc.
> > Get Certified Today * Register for a JBoss Training Course
> > Free Certification Exam for All Training Attendees Through End of 2005
> > Visit http://www.jboss.com/services/certification for more information
> > _______________________________________________
> > Opensg-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/opensg-users
> > 
> > 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through End of 2005
> Visit http://www.jboss.com/services/certification for more information
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
> 


Spam detection software, running on the system "amanda.natdesign.m.se", has
identified this incoming email as possible spam.  The original message
has been attached to this so you can view it (if it isn't spam) or block
similar future email.  If you have any questions, see
[EMAIL PROTECTED] for details.

Content preview:  Hi all. From my experience with shaders, you get this
  error when you have setting a uniform which is not declared _nor_ used
  in the shader. The glsl-compiler, at least for nvidia, then optimizes
  away that parameter, so when setting it, you get an error. [...] 

Content analysis details:   (5.8 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
 0.3 NO_REAL_NAME           From: does not include a real name
 1.0 FROM_ENDS_IN_NUMS      From: ends in numbers
 4.5 REGISTER_1             BODY: Asks you to register


Reply via email to