Problem Passing Parameters to Shader in v1-8-0 [SOLVED]

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Problem Passing Parameters to Shader in v1-8-0 [SOLVED]

Post by DavlexDesign »

G'day guys,

Just a query, but, with this new release of Ogre 1-8-0, is there some changes I'm missing for modifying parameters to shaders from within the engine ?
I compile up my engine, and it compiles fine, if I set it to not modify the parameters it works (looks like crap but runs fine), I set it to modify the parameters and it locks up, no log messages, just an exception, and stops working (the usual windows box pops up with a progress bar in it, saying the program has stopped).

Code: Select all

Ogre::GpuProgramParametersSharedPtr vparams = CloudEntity->getSubEntity(0)->getTechnique()->getPass(0)->getVertexProgramParameters();
Ogre::GpuProgramParametersSharedPtr fparams = skyEntity->getSubEntity(0)->getTechnique()->getPass(0)->getFragmentProgramParameters();
vparams->setNamedConstant("UnderClouds", Ogre::Vector4( separation, (float)nitpcount, CloudAlt, Altitude));
fparams->setNamedConstant("BoundSky", Ogre::Vector4(MaxHeight, PlanetRadius, AtmoHeight, Altitude));
This won't work any more ?

P.S. These parameters change on a frame by frame basis, and the compile of the shader is fine, no missing parameters or anything silly like that, OH, and the shader is written in cg.
P.P.S OH yeah, I use the iteration XX for pass 0 as well in the cloud material defenition.
Alex
Last edited by DavlexDesign on Tue Jun 05, 2012 12:54 pm, edited 1 time in total.
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

Re: Problem Passing Parameters to Shader in version 1-8-0

Post by lingfors »

Have you tried using setCustomParameter instead?
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: Problem Passing Parameters to Shader in version 1-8-0

Post by Wolfmanfx »

Can you provide a (simple) repo case and then enter a bug into the bugtracker?
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Re: Problem Passing Parameters to Shader in version 1-8-0

Post by DavlexDesign »

G'day Guys,
lingfors wrote:Have you tried using setCustomParameter instead?
Yes I have, and I use them also, for parameters that need to change per object / entity.
From what I gather ....

Normal uniforms are material wide, as in setup a material to be shared among several objects, and don't change that parameter for the current run through the render pipeline.
Custom parameters are there for a per entity / object parameter change while still sharing that same material in the current run through the render pipeline.
Wolfmanfx wrote:Can you provide a (simple) repo case and then enter a bug into the bugtracker?
OK, what's a "(simple) repo case" ?

OH, thank's for the replies, by the way.

Alex
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: Problem Passing Parameters to Shader in version 1-8-0

Post by Wolfmanfx »

Simple reproduction case is based on the ogre samples where you try to reproduce the error in given test env (the samplebrowser) otherwise its not easy to look into.
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Re: Problem Passing Parameters to Shader in v1-8-0 [SOLVED]

Post by DavlexDesign »

Sorry Guys,

Nothing to do with parameter passing, all that stuff works fine.

It was in a previous command ...

Code: Select all

		Ogre::Pass *pparams = CloudEntity->getSubEntity(0)->getTechnique()->getPass(0);
In the Ogre 1-8-0 RC version it must have been more forgiving, because I had a getPass(1) in there, and that still worked, even though I had removed the passes in the material definition.
In the Ogre 1-8-0 final it wouldn't tolerate that, good thing really, but no clue in the exception as to what was going on.

It's my own silly fault, so sorry guys for asking too soon, I need to remember more about what I have done and what I am doing.

Thanks for the help / suggestions.

Alex
Post Reply