Hi Dj and Tim
thanks for the answers, I made a little hack, but it works for me ;-) In
the operator() method I just set the pre draw callback of the camera to
zero, so the method never gets called again later.
void GameViewOSG::GameViewOSGDrawCallback::operator()(const Camera&) const
{
parent->osgCamera->setPreDrawCallback(NULL);
}
Regards
Dominic
Am 09.01.10 00:55, schrieb Tim Moore:
On Fri, Jan 8, 2010 at 9:50 PM, Dominic Stalder
<[email protected] <mailto:[email protected]>> wrote:
Hi there
I would like to read the OpenGL extensions with
isGLExtensionSupported(), but for this I need a draw context. I
registred a DrawCallback Class, see below. I need to call the
operator() method only once, but because this method is const, I
cannot write to the member variable bool first. How can I resolve
this problem?
class GameViewOSGDrawCallback : public
osg::Camera::DrawCallback
{
private:
GameViewOSG *parent;
bool first;
public:
GameViewOSGDrawCallback(GameViewOSG* parent=0);
virtual void operator()(const osg::Camera&) const;
};
You might look at using an Operation on the graphics context, which
has a "one-shot" mode that is more convenient and efficient than a
boolean in a callback. Take a look at the Operation class in
osg/OperationThread and osg::GraphicsContext::add(Operation*).
Tim
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org