Re: [osg-news] virtual inheritance
Brought to you by:
robertosfield
From: <uni...@ta...> - 2002-10-11 09:18:45
|
I=20now=20realise=20that=20the=20drawcallback=20also=20has=20an=20inherited=20virtual=20drawImmediateMode=20which=20needed=20defining.=20This=20has=20generated=20a=20new=20problem,=20namely=20accessing=20the=20drawImmediateMode=20in=20myClass(the=20ImpostorSprite=20derivative).=20I=20have=20passed=20an=20instance=20of=20myClass=20to=20the=20drawCallback=20and=20a=20la=20the=20AppCallback=20but=20have=20now=20abandoned=20the=20AppCallback.=20Thus=20to=20access=20the=20drawImmediateMode=20I=20have=20ptrClass->drawImmediateMode(state); Both=20drawImmediateModes=20are=20being=20entered=20but=20nothing=20appears=20to=20be=20drawn=20on=20the=20screen=20(no=20matter=20which=20function=20it's=20drawn=20in). James. >=20Dear=20All, >I=20am=20having=20a=20problem=20attaching=20a=20drawcallback=20to=20a=20drawable.=20I=20have=20two=20structures: >struct=20myAppCallback=20:=20public=20osg::Drawable::AppCallback >and >struct=20myDrawCallback=20:=20public=20osg::Drawable::DrawCallback > >I=20ran=20into=20problems=20with=20the=20appcallback=20initially=20-=20I=20wanted=20to=20alter=20the=20parameters=20passed=20to=20the=20void=20virtual=20app=20function.=20It=20turned=20out=20that=20the=20compiler=20error=20meant=20that=20the=20virtual=20function=20in=20osg::Drawable::AppCallback=20had=20to=20be=20defined=20in=20myAppCallback=20and=20so=20I=20had=20to=20leave=20the=20original=20parameters=20intact.=20I've=20got=20round=20this=20problem=20and=20so=20the=20appcallback=20is=20okay.=20I=20have=20a=20class=20derived=20from=20ImpostorSprite: >class=20myClass=20:=20public=20osg::ImpostorSprite > >I=20have=20set=20the=20callback=20via: >geode->getDrawable(0)->setAppCallback(new=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20myAppCallback(Class)); >where=20Class=20is=20an=20existing=20instance=20of=20myClass. > >As=20I=20said,=20this=20works.=20The=20problem=20is=20the=20drawcallback. >The=20structure=20is=20simple=20enough: >struct=20myDrawCallback=20:=20public=20osg::Drawable::DrawCallback >{ >public: >myDrawCallback() >{ >=20std::cout=20<=20"draw=20callback=20constructor\n"; >} > >void=20operator()=20(osg::State&=20state,osg::Drawable*=20drawable)=20const >{ >=20drawable->drawImmediateMode(state); >} >}; > >But=20when=20I=20try=20to=20set=20the=20callback=20the=20original=20compiler=20error=20returns=20(C2259=20followed=20by=20C4259=20-=20the=20one=20about=20virtual=20functions=20not=20being=20defined). > >geode->getDrawable(0)->setDrawCallback(new=20myDrawCallback()); > >Any=20ideas=3F > >TIA, >James. > > > >-------------------- >talk21=20your=20FREE=20portable=20and=20private=20address=20on=20the=20net=20at=20<a=20Target=3D'_new'=20Href=3D'http://talk21.btopenworld.com/redirect.html=3Fhttp://www.talk21.com'>http://www.talk21.com</a> > > > > >------------------------------------------------------- >This=20sf.net=20email=20is=20sponsored=20by:ThinkGeek >Welcome=20to=20geek=20heaven. ><a=20Target=3D'_new'=20Href=3D'http://talk21.btopenworld.com/redirect.html=3Fhttp://thinkgeek.com/sf'>http://thinkgeek.com/sf</a> >_______________________________________________ >Openscenegraph-news=20mailing=20list >Ope...@li... >https://lists.sourceforge.net/lists/listinfo/openscenegraph-news -------------------- talk21=20your=20FREE=20portable=20and=20private=20address=20on=20the=20net=20at=20http://www.talk21.com |