Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

GlDrawManager.h

Go to the documentation of this file.
00001 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
00002  *
00003  * VR Juggler is (C) Copyright 1998-2003 by Iowa State University
00004  *
00005  * Original Authors:
00006  *   Allen Bierbaum, Christopher Just,
00007  *   Patrick Hartling, Kevin Meinert,
00008  *   Carolina Cruz-Neira, Albert Baker
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Library General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Library General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Library General Public
00021  * License along with this library; if not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023  * Boston, MA 02111-1307, USA.
00024  *
00025  * -----------------------------------------------------------------
00026  * File:          $RCSfile: GlDrawManager.h,v $
00027  * Date modified: $Date: 2004/04/20 23:08:59 $
00028  * Version:       $Revision: 1.61 $
00029  * -----------------------------------------------------------------
00030  *
00031  *************** <auto-copyright.pl END do not edit this line> ***************/
00032 
00033 #ifndef _VRJ_GL_DRAW_MANAGER_H_
00034 #define _VRJ_GL_DRAW_MANAGER_H_
00035 
00036 #include <vrj/vrjConfig.h>
00037 #include <vector>
00038 
00039 #include <vpr/vpr.h>
00040 //#include <vpr/Sync/CondVar.h>
00041 #include <vpr/Sync/Semaphore.h>
00042 #include <vpr/Util/Singleton.h>
00043 #include <vpr/Thread/Thread.h>
00044 #include <vpr/Thread/TSObjectProxy.h>
00045 
00046 #ifdef VPR_OS_Darwin
00047 #   include <OpenGL/gl.h>
00048 #   include <OpenGL/glu.h>
00049 #else
00050 #   include <GL/gl.h>
00051 #   include <GL/glu.h>
00052 #endif
00053 
00054 #include <jccl/Config/ConfigElementPtr.h>
00055 
00056 #include <vrj/Draw/DrawManager.h>
00057 //#include <vrj/Draw/OGL/GlApp.h>
00058 #include <vrj/Draw/OGL/GlWindow.h>
00059 #include <vrj/Draw/OGL/GlPipe.h>
00060 #include <vrj/Draw/OGL/GlUserData.h>
00061 
00062 namespace vrj
00063 {
00064    class GlApp;
00065    class SimViewport;
00066 
00085 class VJ_CLASS_API GlDrawManager : public DrawManager
00086 {
00087 public:
00088    friend class GlPipe;
00089    friend class GlContextDataBase;
00090 
00095    //**//virtual void configInitial(jccl::Configuration*  cfg);
00096 
00098    virtual void start();
00099 
00101    virtual void draw();
00102 
00108    virtual void sync();
00109 
00111    void main(void* nullParam);
00112 
00114    virtual void initAPI();
00115 
00124    virtual void addDisplay(Display* disp);
00125 
00127    virtual void removeDisplay(Display* disp);
00128 
00130    virtual void closeAPI();
00131 
00133    virtual void outStream(std::ostream& out);
00134 
00136    void drawAllPipes();
00137 
00139    virtual void setApp(App* _app);
00140 
00142    GlApp* getApp();
00143 
00144    //void setDisplayManager(DisplayManager* _dispMgr);
00145 
00146 public: // Config element handlers
00153    virtual bool configAdd(jccl::ConfigElementPtr element);
00154 
00161    virtual bool configRemove(jccl::ConfigElementPtr element);
00162 
00168    virtual bool configCanHandle(jccl::ConfigElementPtr element);
00169 
00170 
00171 public:
00178    GlUserData* currentUserData()
00179    { return &(*mUserData); }
00180 
00186    int getCurrentContext()
00187    { return (*mContextId); }
00188 
00189 protected:
00195    GlWindow* getGLWindow();
00196 
00197    void setCurrentContext(int val)
00198    { (*mContextId) = val; }
00199 
00201    void dirtyAllWindows();
00202 
00204    bool isValidWindow(GlWindow* win);
00205 
00206 
00207 protected:
00208    // --- Config Data --- //
00209    int      numPipes;     
00211    // --- API data --- //
00212    GlApp*                 mApp;      
00213    std::vector<GlWindow*> mWins;     
00214    std::vector<GlPipe*>   pipes;    
00216    // --- Helper field data --- //
00217    vpr::TSObjectProxy<int>           mContextId;   
00218    vpr::TSObjectProxy<GlUserData>    mUserData;    
00220    // --- MP Stuff -- //
00221    vpr::Semaphore    drawTriggerSema;  
00222    vpr::Semaphore    drawDoneSema;     
00223    //vpr::Semaphore    mRuntimeConfigSema;  /**< Protects run-time config.  Only when this semaphore
00224    //                                     *  is acquired can run-time config occur */
00225    bool              mRunning;         
00227    vpr::ThreadMemberFunctor<GlDrawManager>* mMemberFunctor;
00228    vpr::Thread* mControlThread;
00229 
00230 protected:
00231    GlDrawManager();
00232 
00233    virtual ~GlDrawManager()
00234    {
00235       // XXX: Need to shut down the control thread and free the memory pointed
00236       // to by mMemberFunctor and mControlThread.
00237    }
00238 
00239    GlDrawManager(const GlDrawManager& o)
00240       : DrawManager()
00241    {;}
00242 
00243    void operator=(const GlDrawManager& o) {;}
00244 
00245    vprSingletonHeader(GlDrawManager);
00246 };
00247 
00248 } // end namespace
00249 
00250 #endif

Generated on Sun May 2 15:10:17 2004 for VR Juggler by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002