Hello Aashish,
Aashish Chaudhary wrote:
Thanks for the cpp. I built the opensg rev 1943 and applied your patch.
But seems like I am seeing an odd behavior. Instead of getting different
materials (textures, shaders), I get the same material.
argh, I forgot a line in the patch, please try the new one instead
(attached).
I dumped the scene as osb file attached with this email.
thanks, having a test case is always helpful :)
Cheers,
Carsten
Index: Source/System/State/SHL/OSGSHLChunk.cpp
===================================================================
--- Source/System/State/SHL/OSGSHLChunk.cpp (revision 1943)
+++ Source/System/State/SHL/OSGSHLChunk.cpp (working copy)
@@ -2162,6 +2162,7 @@
StateChunk *old_chunk,
UInt32 /*idx*/)
{
+ Window *win = pEnv->getWindow();
SHLChunk *old = dynamic_cast<SHLChunk *>(old_chunk);
if(old == NULL)
@@ -2170,53 +2171,42 @@
return;
}
- // SHLChunk didn't change so do nothing.
- if(old == this)
- return;
+ win->validateGLObject(getGLId(), pEnv);
+ GLuint progId = GLuint(win->getGLObjectId(getGLId()));
- pEnv->getWindow()->validateGLObject(getGLId(), pEnv);
+ if(progId != pEnv->getActiveShader())
+ {
+ if(progId == 0)
+ return;
- // get "glUseProgramObjectARB" function pointer
- OSGGLUSEPROGRAMOBJECTARBPROC useProgramObject =
- reinterpret_cast<OSGGLUSEPROGRAMOBJECTARBPROC>(
- pEnv->getWindow()->getFunction(_funcUseProgramObject));
+ win ->validateGLObject(getGLId(), pEnv);
+ pEnv->incNumShaderChanges();
- GLuint program = GLuint(pEnv->getWindow()->getGLObjectId(getGLId()));
+ // get "glUseProgramObjectARB" function pointer
+ OSGGLUSEPROGRAMOBJECTARBPROC useProgramObject =
+ reinterpret_cast<OSGGLUSEPROGRAMOBJECTARBPROC>(
+ win->getFunction(_funcUseProgramObject));
- if(program != 0)
- {
- useProgramObject(program);
- pEnv->setActiveShader(program);
+ useProgramObject (progId);
+ pEnv->setActiveShader(progId);
- updateOSGParameters(pEnv, program);
-#if 0
- updateParameters(pEnv->getWindow(), getParameters(),
- false, // don't use program
- false, // don't force updates
- true); // keep the program active
-#endif
-
- if(getPointSize())
+ if(_sfPointSize.getValue() == true)
{
- if(!old->getPointSize())
+ if(old->getPointSize() == false)
+ {
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
+ }
}
else
{
- if(old->getPointSize())
+ if(old->getPointSize() == true)
+ {
glDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
+ }
}
}
- else
- {
- if(pEnv->getWindow()->getGLObjectId(old->getGLId()) != 0)
- {
- useProgramObject(0);
- pEnv->setActiveShader(0);
- }
- }
- pEnv->incNumShaderChanges();
+ updateOSGParameters(pEnv, progId);
}
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users