Hi,

On Wed, 2010-03-17 at 17:10 +0100, Andreas Halm wrote:
> Hello,
> 
> > 
> > some of this is backwards compatibility stuff, new code should use
> > System/State/Shader:
> > 
> > vp = ShaderProgram::createVertexShader();
> > fp = ShaderProgram::createFragmentShader();
> > 
> > vp->setProgram( ... );
> > fp->setProgram( ... );
> > 
> > vp->addUniformVariable("someUniform", someValue);
> > 
> > sh = ShaderProgramChunk::create();
> > sh->addShader(vp);
> > sh->addShader(fp);
> > 
> > finally add the chunk to your material.
> 
> Thats what I do exactly and I keep getting
> OpenSG FATAL: ShaderProgramChunk::deactivate
> Although the rendering looks correct. This doesn't happen if I create a
> ShaderExecutableChunk myself und use activate/deactivate on it. That would
> be an alternative but if I understood correctly that class should normally
> not be used by me?

yes ShaderExecutableChunk should not be used, the error is weird. I have
a look, I wanted to look into something else in this area anyway.

> I am using a ChunkMaterial and my render setup is:
> 
> func = boost::bind(&Residue::draw,this,_1); 
> pPrimeMat = material->finalize(a->getRenderProperties());
> State *st = pPrimeMat->getState(0);
> a->dropFunctor(func,st,pPrimeMat->getSortKey() + 0);
> 
> which I shamelessly copied from OSGMaterialDrawable ;-)
> 
> So actually I have two working setups, one is throwing errors which I don't
> understand and I should not use the other one.
> 
> Additionally, the state switch occurs multiple times per frame, which would
> not be needed. I guess it is because the finalize call creates a new
> primematerial every time it is called, so there is no easy way to compare
> the last used state with the current one. 

no, the finalize only retrieves what is already there, if it creates
something it should be cached (but nothing in there yet does this yet). 

In order to understand this better a few questions

a) which chunks are set for the generated state ?
b) are there overrides except for lights ?
c) are these duplicated state switches for elements with the
   same material (same object) or different material which just share
   some chunks ?

kind regards
 gerrit




------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to