diff --git a/include/osg/GLBeginEndAdapter b/include/osg/GLBeginEndAdapter index 27dc1c690..c56a789f6 100644 --- a/include/osg/GLBeginEndAdapter +++ b/include/osg/GLBeginEndAdapter @@ -30,6 +30,10 @@ class OSG_EXPORT GLBeginEndAdapter GLBeginEndAdapter(State* state=0); + void setState(State* state) { _state = state; } + State* setState() { return _state; } + const State* setState() const { return _state; } + enum MatrixMode { APPLY_LOCAL_MATRICES_TO_VERTICES, diff --git a/src/osg/State.cpp b/src/osg/State.cpp index d0bdea730..04b18114d 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -37,8 +37,7 @@ using namespace osg; static ApplicationUsageProxy State_e0(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_GL_ERROR_CHECKING ","ONCE_PER_ATTRIBUTE | ON | on enables fine grained checking, ONCE_PER_FRAME enables coarse grained checking"); State::State(): - Referenced(true), - _glBeginEndAdapter(this) + Referenced(true) { _graphicsContext = 0; _contextID = 0; @@ -119,6 +118,8 @@ State::State(): _maxTexturePoolSize = 0; _maxBufferObjectPoolSize = 0; + + _glBeginEndAdapter.setState(this); } State::~State()