Hi, Dominic.

I'm not sure this method is the best option for what you want, but I
don't have any ready alternatives myself, so I'll just answer your
question and move on.

I would recommend reading the following FAQ:

http://www.parashift.com/c++-faq-lite/const-correctness.html

In that context, I might recommend changing your declaration:

// begin code
bool first;
// end code

to this:

// begin code
mutable bool first;
// end code

In the event that your compiler doesn't support keyword "mutable", you
can fake it with a member pointer that you have to initialize in your
constructor and cleanup in your destructor, but that is a little
clunky, and I would avoid it if I could.  You would change this:

// begin code
bool first;
// end code

to this:

// begin code
bool* first;
// end code

and then do the appropriate initialization and cleanup.

I hope this helps...

D.J.


On Fri, Jan 8, 2010 at 3:50 PM, Dominic Stalder
<dominic.stal...@bluewin.ch> 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;
>        };
>
> Thanks a lot
> Dominic
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to