00001 #ifndef __RE_Visual_h__ 00002 #define __RE_Visual_h__ 00003 00004 #include "RE_API.h" 00005 #include <UT/UT_Defines.h> 00006 #include <UT/UT_Lock.h> 00007 #include <UT/UT_Pointers.h> 00008 #include <UT/UT_RefArray.h> 00009 #include <UT/UT_ThreadSpecificValue.h> 00010 #include "RE_Types.h" 00011 #include "RE_OGLRender.h" 00012 00013 class RE_Window; 00014 00015 class RE_API RE_Visual 00016 { 00017 public: 00018 RE_Visual(); 00019 virtual ~RE_Visual(); 00020 00021 #if RE_OGL_SINGLE_CONTEXT 00022 // needs_initialization will be set to true if the context was just 00023 // created and needs to have its OpenGL state initialized. 00024 virtual RE_OGLContext getGraphicsContext(bool &needs_initialization, 00025 RE_Window *win) = 0; 00026 virtual RE_OGLContext getAlternateContext(bool &needs_initialization, 00027 RE_Window *win) = 0; 00028 #else 00029 virtual RE_OGLContext createContext(RE_Window *win) const = 0; 00030 virtual void deleteContext(RE_OGLContext) const = 0; 00031 00032 RE_OGLContext grabContext(RE_Window *win); 00033 void returnContext(RE_Window *win, RE_OGLContext ctx); 00034 #endif 00035 00036 // isMode() returns true on an exact match. isCompatibleWithMode() returns 00037 // true if this visual is equal to or a superset of the features in 'match' 00038 bool isMode(RE_DisplayMode match) const; 00039 bool isCompatibleWithMode(RE_DisplayMode match) const; 00040 00041 int isRGB() const; 00042 00043 RE_DisplayMode getMode() const { return myVisualMode; } 00044 int getDepth() const; 00045 int getNumColors() const; 00046 00047 protected: 00048 RE_DisplayMode myVisualMode; 00049 00050 unsigned short depth; 00051 unsigned short numColors; 00052 00053 RE_OGLContext myMainThreadContext; 00054 RE_OGLContext myMainThreadAltContext; 00055 UT_ThreadSpecificValue<RE_OGLContext> myThreadSpecificContext; 00056 UT_ThreadSpecificValue<RE_OGLContext> myThreadSpecificAlternateContext; 00057 bool myInitializedMainThreadContext; 00058 00059 UT_Lock myContextLock; 00060 UT_RefArray<RE_OGLContext> myVisibleContexts; 00061 UT_RefArray<RE_OGLContext> myOffscreenContexts; 00062 }; 00063 00064 #endif
1.5.9