summaryrefslogtreecommitdiffstats
path: root/libvo/gl_common.h
diff options
context:
space:
mode:
authorKovensky <diogomfranco@gmail.com>2012-01-27 01:31:33 +0000
committerwm4 <wm4@mplayer2.org>2012-03-31 02:58:52 +0200
commit59125ce71e378ae169eaecc8ac04d72bda3d130d (patch)
tree16768bcf5a0b41e627c8a45fd88ac0ca170fa8bc /libvo/gl_common.h
parent666915a6f01b01a4b5c087e78e92a5a7304f5598 (diff)
downloadmpv-59125ce71e378ae169eaecc8ac04d72bda3d130d.tar.bz2
mpv-59125ce71e378ae169eaecc8ac04d72bda3d130d.tar.xz
gl_common: OpenGL 3.x context support on windows
Also include GL/glext.h on windows: Mingw's (and cygwin's) GL/gl.h has GL/glext.h's inclusion commented out for some reason. Their glext.h is also ancient, so do yourself a favor and replace your GL/glext.h with the one from http://www.opengl.org/registry/api/glext.h . A workaround is needed for NVidia's broken wglCreateContextAtrribsARB: It'll return an error if the requested OpenGL version is previous to 3.2 *and* you request a profile... which is exactly *not* what the wgl_create_context spec says should happen. Handle it by removing the profile request from attribs[] and retrying the context creation once more if the first try fails. And after my first foray into OpenGL I already find a driver quirk. Oh well.
Diffstat (limited to 'libvo/gl_common.h')
-rw-r--r--libvo/gl_common.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/libvo/gl_common.h b/libvo/gl_common.h
index a045321d71..5b35e0aa63 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -46,6 +46,10 @@
#endif
#include <GL/gl.h>
+#ifdef CONFIG_GL_WIN32
+#include <GL/glext.h>
+#endif
+
// workaround for some gl.h headers
#ifndef GLAPIENTRY
#ifdef APIENTRY
@@ -563,7 +567,24 @@ struct GL {
const GLfloat *);
void (GLAPIENTRY *UniformMatrix4x3fv)(GLint, GLsizei, GLboolean,
const GLfloat *);
-
+#ifdef CONFIG_GL_WIN32
+ HGLRC (GLAPIENTRY *wglCreateContextAttribsARB)(HDC hDC, HGLRC hShareContext,
+ const int *attribList);
+#endif
};
+
+#if defined(CONFIG_GL_WIN32) && !defined(WGL_CONTEXT_MAJOR_VERSION_ARB)
+/* these are supposed to be defined in wingdi.h but mingw's is too old */
+/* only the bits actually used by mplayer are defined */
+/* reference: http://www.opengl.org/registry/specs/ARB/wgl_create_context.txt */
+
+#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
+#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
+#define WGL_CONTEXT_FLAGS_ARB 0x2094
+#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
+#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
+#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+#endif
+
#endif /* MPLAYER_GL_COMMON_H */