#endif
#include "ODGauge.hxx"
+#include "Canvas.hxx"
#include "CanvasSystemAdapter.hxx"
#include <simgear/debug/logstream.hxx>
#include <osg/ShadeModel>
#include <osg/StateSet>
#include <osg/FrameBufferObject> // for GL_DEPTH_STENCIL_EXT on Windows
+#include <osg/Version>
#include <osgUtil/RenderBin>
#include <cassert>
clear();
}
- //----------------------------------------------------------------------------
- void ODGauge::setSystemAdapter(const SystemAdapterPtr& system_adapter)
- {
- _system_adapter = system_adapter;
- }
-
//----------------------------------------------------------------------------
void ODGauge::setSize(int size_x, int size_y)
{
updateSampling();
updateBlendMode();
- if( _system_adapter )
- _system_adapter->addCamera(camera.get());
+ if( Canvas::getSystemAdapter() )
+ Canvas::getSystemAdapter()->addCamera(camera.get());
_flags |= AVAILABLE;
}
//----------------------------------------------------------------------------
void ODGauge::reinit()
{
- osg::NodeCallback* cull_callback = camera ? camera->getCullCallback() : 0;
+ osg::NodeCallback* cull_callback =
+ camera
+#if OSG_VERSION_LESS_THAN(3,3,2)
+ ? camera->getCullCallback()
+#else
+ ? dynamic_cast<osg::NodeCallback*>(camera->getCullCallback())
+#endif
+ : 0;
+
clear();
allocRT(cull_callback);
}
//----------------------------------------------------------------------------
void ODGauge::clear()
{
- if( camera.valid() && _system_adapter )
- _system_adapter->removeCamera(camera.get());
+ if( camera.valid() && Canvas::getSystemAdapter() )
+ Canvas::getSystemAdapter()->removeCamera(camera.get());
camera.release();
texture.release();