00001
00030 #ifndef INC_MI32_MIGLX_H
00031 #define INC_MI32_MIGLX_H
00032
00033 #ifndef INC_MI32_STDDEFNS_H
00034 #include <mi32/stddefns.h>
00035 #endif
00036
00037 #ifndef _XUTIL_H_
00038 #include <X11/Xutil.h>
00039 #endif
00040
00041
00042 #ifdef WIN32
00043 #define GLX_IS_ALLOWED
00044 #endif
00045
00046 #ifndef GENERATING_DOXYGEN_OUTPUT
00047 typedef struct __GLXcontextRec *GLXContext;
00048 namespace MGD {
00049 class DEVICE_MEM32;
00050 }
00051 #endif
00052
00053
00055 class MIGLX {
00056 public:
00057
00059 enum BUFFER {
00060 BUFFER_Front = 0x01,
00061 BUFFER_Back = 0x02,
00062 BUFFER_Left = 0x10,
00063 BUFFER_Right = 0x20,
00064 BUFFER_FrontLeft = 0x11,
00065 BUFFER_FrontRight = 0x21,
00066 BUFFER_BackLeft = 0x12,
00067 BUFFER_BackRight = 0x22,
00068 BUFFER_All = 0x00,
00069 };
00070
00071 enum MODE {
00072 MODE_Any = 0x00,
00073 MODE_DoubleBuffer = 0x01,
00074 MODE_Stereo = 0x02,
00075 };
00076
00077 class CONTEXT {
00078 public:
00079
00081 CONTEXT ();
00082
00084 ~CONTEXT ();
00085
00089 void CopyBackToFront (
00090 const LRECT2D *pRect = 0
00091 );
00092
00095 ERRVALUE CopyFromMemory (
00096 MGD::DEVICE_MEM32 *pDeviceSrc,
00097 BUFFER buffer,
00098 const LRECT2D *pRect = 0
00099 );
00100
00104 bool Create (
00105 MODE mode
00106 );
00107
00109 void Destroy ();
00110
00112 bool IsCreated () const
00113 { return (m_GlxContext != 0); }
00114
00116 bool IsDoubleBuffered () const
00117 { return ((m_mode & MODE_DoubleBuffer) != 0); }
00118
00120 bool IsStereo () const
00121 { return ((m_mode & MODE_Stereo) != 0); }
00122
00124 void MakeCurrent (
00125 XID xwindow
00126 );
00127
00129 void SetTransIdentity (
00130 unsigned int winwidth = 0,
00131 unsigned int winheight = 0
00132 );
00133
00135 void SwapBuffers ();
00136
00138 int TranslateBuffer (
00139 BUFFER buffer
00140 ) const;
00141
00142 private:
00143 #ifndef GENERATING_DOXYGEN_OUTPUT
00144 GLXContext m_GlxContext;
00145 XID m_xwindow;
00146 MODE m_mode;
00147
00148 bool GetWindowDimensions (unsigned int& width, unsigned int& height) const;
00149
00150 CONTEXT (const CONTEXT&);
00151 CONTEXT& operator= (const CONTEXT&);
00152 #endif
00153 };
00154
00157 static ERRVALUE CheckError ();
00158
00161 static bool HasMode (
00162 MODE mode
00163 );
00164
00166 static bool IsEnabled ();
00167
00168 private:
00169 #ifndef GENERATING_DOXYGEN_OUTPUT
00170 static XVisualInfo* ChooseVisual (MODE mode);
00171 #endif
00172 };
00173
00174 #ifndef GENERATING_DOXYGEN_OUTPUT
00175 DEFINE_ENUM_OP_BITWISE(MIGLX::MODE)
00176 #endif
00177
00178 #endif // INC_MI32_MIGLX_H