Hi Robert,

I am not sure if i understood you properly . Did you mean to create the context 
as follows :


Code:


class Context : public GraphicsOperation
{

public:
   Context() : osg::GraphicsOperation("Context",false)
   {
            // initialize some of the opencl related member variables
   }


   virtual void operator() (osg::GraphicsContext *gc)
   {
       //in the argument we get the current and valid graphics context
       //that i shall cast to the OS specific handle and then i shall 
initialize all the 
       //opencl related variables here
   }

   //declare some opencl related variables here


}





Inside the main function i do the following  as mentioned in osgvolume:


Code:

int main()
{
...........................
...........................
osg::ref_ptr<Context> context = new Context;

viewer.setRealizeOperation(context.get());

.................................
................................

}




Please let me know i got you right. 


One more thing .... I want the Context class to be available to the rest of the 
other files in the application . So i was thinking to declare the Context 
object as follows instead :


Code:

   //create a singleton opencl context to make sure that
   //we are only working on one context
   osgOpenCL::Singleton<osgOpenCL::Context>::init();

   
viewer.setRealizeOperation(osgOpenCL::Singleton<osgOpenCL::Context>::getPtr());




It will be nice to hear from you if there is better way to access Context class 
variables. 
I saw that GraphicsOperation constructor takes a boolean variable keep. All the 
examples shows that the boolean variable is initialized to false. What is the 
purpose of this variable ? 

Thanks,
Sajjadul

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56432#56432





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to