00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef _VRJ_GL_WIN_OSX_H_
00034 #define _VRJ_GL_WIN_OSX_H_
00035
00036 #include <vrj/vrjConfig.h>
00037 #include <vector>
00038
00039 #include <vrj/Draw/OGL/GlWindow.h>
00040 #include <vrj/Kernel/Kernel.h>
00041 #include <vrj/Util/Debug.h>
00042 #include <vrj/Display/Display.h>
00043 #include <gadget/Devices/EventWindow/EventWindowOSX.h>
00044
00045 #ifdef __APPLE_CC__
00046 # include <Carbon/Carbon.h>
00047 # include <DrawSprocket/DrawSprocket.h>
00048 # include <AGL/agl.h>
00049 #else
00050 # include <Carbon.h>
00051 # include <DrawSprocket.h>
00052 # include <agl.h>
00053 #endif
00054
00060 struct structGLWindowInfo {
00061 Boolean fAcceleratedMust;
00062 GLint aglAttributes[64];
00063
00064
00065 long VRAM;
00066
00067 long textureRAM;
00068
00069
00070 AGLPixelFormat fmt;
00071 Boolean fDraggable;
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 };
00084
00085 namespace vrj
00086 {
00087
00092 class GlWindowOSX: public GlWindow, public gadget::EventWindowOSX
00093 {
00094 public:
00095 GlWindowOSX();
00096 virtual ~GlWindowOSX();
00097
00098 void swapBuffers();
00099 int open();
00100 int close();
00101 bool makeCurrent();
00102
00107
00112 bool startSampling();
00114
00115 void configWindow(Display* _display);
00116
00117 virtual bool createHardwareSwapGroup(std::vector<GlWindow*> wins);
00118
00119 protected:
00120 OSStatus BuildGLFromWindow(WindowPtr pWindow, AGLContext* paglContext,
00121 structGLWindowInfo* pcontextInfo);
00122
00123 OSStatus BuildGLonWindow(WindowPtr pWindow, AGLContext* paglContext,
00124 structGLWindowInfo* pcontextInfo);
00125
00126 OSStatus DestroyGLFromWindow(AGLContext* paglContext,
00127 structGLWindowInfo* pcontextInfo);
00128
00129 short FindGDHandleFromWindow(WindowPtr pWindow, GDHandle* phgdOnThisDevice);
00130
00131 Boolean CheckRenderer(GDHandle hGD, long *VRAM, long *textureRAM, GLint*,
00132 Boolean fAccelMust);
00133
00134 Boolean CheckAllDeviceRenderers(long* pVRAM, long* pTextureRAM,
00135 GLint* pDepthSizeSupport,
00136 Boolean fAccelMust);
00137
00138 void ReportError(const char* strError);
00139 GLenum aglReportError(void);
00140
00141 private:
00142 int mPipe;
00143 structGLWindowInfo glInfo;
00144 AGLContext aglContext;
00145 Rect rectWin;
00146
00147 WindowPtr gpWindow;
00148 long gFrameWindow;
00149 AbsoluteTime gTimeWindow;
00150 float gRotation;
00151 CFStringRef window_title;
00152
00153 static AGLContext aglShareContext;
00154 };
00155
00156 }
00157
00158 #endif