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?
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. Is there an easy way around this?
Should I save the prime material for reuse until something changes? Just
trying to minimize unnecessary state changes ...

Thanks, Andi



------------------------------------------------------------------------------
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