1 // Copyright (C) 2003 Dolphin Project.
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 2.0.
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 2.0 for more details.
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
15 // Official SVN repository and contact information can be found at
16 // http://code.google.com/p/dolphin-emu/
21 #include "VideoConfig.h"
23 #include "pluginspecs_video.h"
29 #include <GLew/glew.h>
30 #include <GLew/wglew.h>
32 #include <GLew/glext.h>
34 #else // linux and apple basic definitions
36 #if defined(USE_WX) && USE_WX
39 #include "wx/glcanvas.h"
41 #elif defined(HAVE_X11) && HAVE_X11
43 #include <X11/XKBlib.h>
45 #include <X11/keysym.h>
47 #if defined(HAVE_XRANDR) && HAVE_XRANDR
48 #include <X11/extensions/Xrandr.h>
51 #elif defined(USE_SDL) && USE_SDL
55 #elif defined(HAVE_COCOA) && HAVE_COCOA
60 #if defined(__APPLE__)
61 #include <OpenGL/gl.h>
66 #endif // linux basic definitions
68 #ifndef GL_DEPTH24_STENCIL8_EXT // allows FBOs to support stencils
69 #define GL_DEPTH_STENCIL_EXT 0x84F9
70 #define GL_UNSIGNED_INT_24_8_EXT 0x84FA
71 #define GL_DEPTH24_STENCIL8_EXT 0x88F0
72 #define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
78 #include <sys/types.h>
82 #if defined(HAVE_COCOA) && HAVE_COCOA
84 NSOpenGLContext
*cocoaCtx
;
85 #elif defined(HAVE_X11) && HAVE_X11
91 XSetWindowAttributes attr
;
92 Common::Thread
*xEventThread
;
93 #if defined(HAVE_XRANDR) && HAVE_XRANDR
94 XRRScreenConfiguration
*screenConfig
;
95 Rotation screenRotation
;
96 int deskSize
, fullSize
;
99 #if defined(USE_WX) && USE_WX
100 wxGLCanvas
*glCanvas
;
105 unsigned int width
, height
;
108 extern GLWindow GLWin
;
112 // Public OpenGL util
114 // Initialization / upkeep
115 bool OpenGL_Create(SVideoInitialize
&_VideoInitialize
, int _width
, int _height
);
116 void OpenGL_Shutdown();
117 void OpenGL_Update();
118 bool OpenGL_MakeCurrent();
119 void OpenGL_SwapBuffers();
122 u32
OpenGL_GetBackbufferWidth();
123 u32
OpenGL_GetBackbufferHeight();
126 void OpenGL_SetWindowText(const char *text
);
128 // Error reporting - use the convenient macros.
129 void OpenGL_ReportARBProgramError();
130 GLuint
OpenGL_ReportGLError(const char *function
, const char *file
, int line
);
131 bool OpenGL_ReportFBOError(const char *function
, const char *file
, int line
);
134 #define GL_REPORT_ERROR() OpenGL_ReportGLError (__FUNCTION__, __FILE__, __LINE__)
135 #define GL_REPORT_PROGRAM_ERROR() OpenGL_ReportARBProgramError()
136 #define GL_REPORT_FBO_ERROR() OpenGL_ReportFBOError (__FUNCTION__, __FILE__, __LINE__)
138 #define GL_REPORT_ERROR() GL_NO_ERROR
139 #define GL_REPORT_PROGRAM_ERROR()
140 #define GL_REPORT_FBO_ERROR()
143 #if defined(_DEBUG) || defined(DEBUGFAST)
144 #define GL_REPORT_ERRORD() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
146 #define GL_REPORT_ERRORD()
152 extern CGcontext g_cgcontext
;
153 extern CGprofile g_cgvProf
, g_cgfProf
;