summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-26 13:47:18 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-26 13:47:18 +0000
commit1feebc74c76bc7e1efb78f10843c79b385d12264 (patch)
treeade7489a6c1d7a6d64260819c147fe8352e78d5a /libvo
parentdf2887dd4a7c7bc6d23928ecdf95b3afbc79648f (diff)
downloadmpv-1feebc74c76bc7e1efb78f10843c79b385d12264.tar.bz2
mpv-1feebc74c76bc7e1efb78f10843c79b385d12264.tar.xz
OpenGL fixes for windows and vo_gl.c ported to windows.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16110 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/gl_common.c8
-rw-r--r--libvo/gl_common.h2
-rw-r--r--libvo/vo_gl.c39
-rw-r--r--libvo/w32_common.c2
-rw-r--r--libvo/w32_common.h1
5 files changed, 48 insertions, 4 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 05c6974967..2c3b9ebcc6 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -3,7 +3,7 @@
void (APIENTRY *BindBuffer)(GLenum, GLuint);
GLvoid* (APIENTRY *MapBuffer)(GLenum, GLenum);
GLboolean (APIENTRY *UnmapBuffer)(GLenum);
-void (APIENTRY *BufferData)(GLenum, GLsizeiptr, const GLvoid *, GLenum);
+void (APIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum);
void (APIENTRY *CombinerParameterfv)(GLenum, const GLfloat *);
void (APIENTRY *CombinerParameteri)(GLenum, GLint);
void (APIENTRY *CombinerInput)(GLenum, GLenum, GLenum, GLenum, GLenum,
@@ -257,6 +257,10 @@ static void getFunctions() {
}
#ifdef GL_WIN32
+static void *w32gpa(const GLubyte *procName) {
+ return wglGetProcAddress(procName);
+}
+
int setGlWindow(int *vinfo, HGLRC *context, HWND win)
{
int new_vinfo;
@@ -304,7 +308,7 @@ int setGlWindow(int *vinfo, HGLRC *context, HWND win)
wglDeleteContext(*context);
*context = new_context;
*vinfo = new_vinfo;
- getProcAddress = wglGetProcAddress;
+ getProcAddress = w32gpa;
getFunctions();
// and inform that reinit is neccessary
diff --git a/libvo/gl_common.h b/libvo/gl_common.h
index ad60773afc..62d34ef5fd 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -55,7 +55,7 @@ void releaseGlContext(XVisualInfo **vinfo, GLXContext *context);
extern void (APIENTRY *BindBuffer)(GLenum, GLuint);
extern GLvoid* (APIENTRY *MapBuffer)(GLenum, GLenum);
extern GLboolean (APIENTRY *UnmapBuffer)(GLenum);
-extern void (APIENTRY *BufferData)(GLenum, GLsizeiptr, const GLvoid *, GLenum);
+extern void (APIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum);
extern void (APIENTRY *CombinerParameterfv)(GLenum, const GLfloat *);
extern void (APIENTRY *CombinerParameteri)(GLenum, GLint);
extern void (APIENTRY *CombinerInput)(GLenum, GLenum, GLenum, GLenum, GLenum,
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 2fd6769e46..37c8e162b1 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -30,6 +30,10 @@ static vo_info_t info =
LIBVO_EXTERN(gl)
+#ifdef GL_WIN32
+static int gl_vinfo = 0;
+static HGLRC gl_context = 0;
+#else
static XVisualInfo *gl_vinfo = NULL;
static GLXContext gl_context = 0;
static int wsGLXAttrib[] = { GLX_RGBA,
@@ -38,6 +42,7 @@ static int wsGLXAttrib[] = { GLX_RGBA,
GLX_BLUE_SIZE,1,
GLX_DOUBLEBUFFER,
None };
+#endif
static int use_osd;
static int scaled_osd;
@@ -76,11 +81,13 @@ static unsigned int slice_height = 1;
static void resize(int x,int y){
mp_msg(MSGT_VO, MSGL_V, "[gl] Resize: %dx%d\n",x,y);
+#ifndef GL_WIN32
if (WinID >= 0) {
int top = 0, left = 0, w = x, h = y;
geometry(&top, &left, &w, &h, vo_screenwidth, vo_screenheight);
glViewport(top, left, w, h);
} else
+#endif
glViewport( 0, 0, x, y );
glMatrixMode(GL_PROJECTION);
@@ -198,6 +205,16 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
goto glconfig;
}
#endif
+#ifdef GL_WIN32
+ o_dwidth = d_width;
+ o_dheight = d_height;
+ vo_fs = flags & VOFLAG_FULLSCREEN;
+ vo_vm = flags & VOFLAG_MODESWITCHING;
+ vo_dwidth = d_width;
+ vo_dheight = d_height;
+ if (!createRenderingContext())
+ return -1;
+#else
if (WinID >= 0) {
Window win_tmp;
int int_tmp;
@@ -270,6 +287,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
vo_x11_nofs_sizepos(vo_dx, vo_dy, d_width, d_height);
if (vo_fs ^ (flags & VOFLAG_FULLSCREEN))
vo_x11_fullscreen();
+#endif
glconfig:
setGlWindow(&gl_vinfo, &gl_context, vo_window);
@@ -280,7 +298,11 @@ glconfig:
static void check_events(void)
{
+#ifdef GL_WIN32
+ int e=vo_w32_check_events();
+#else
int e=vo_x11_check_events(mDisplay);
+#endif
if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight);
if(e&VO_EVENT_EXPOSE && int_pause) flip_page();
}
@@ -442,7 +464,11 @@ flip_page(void)
// glFlush();
glFinish();
+#ifdef GL_WIN32
+ SwapBuffers(vo_hdc);
+#else
glXSwapBuffers( mDisplay,vo_window );
+#endif
if (vo_fs && use_aspect)
glClear(GL_COLOR_BUFFER_BIT);
@@ -535,7 +561,11 @@ uninit(void)
{
if ( !vo_config_count ) return;
releaseGlContext(&gl_vinfo, &gl_context);
+#ifdef GL_WIN32
+ vo_w32_uninit();
+#else
vo_x11_uninit();
+#endif
}
static opt_t subopts[] = {
@@ -606,10 +636,19 @@ static uint32_t control(uint32_t request, void *data, ...)
case VOCTRL_GUISUPPORT:
return VO_TRUE;
case VOCTRL_ONTOP:
+#ifdef GL_WIN32
+ vo_w32_ontop();
+#else
vo_x11_ontop();
+#endif
return VO_TRUE;
case VOCTRL_FULLSCREEN:
+#ifdef GL_WIN32
+ vo_w32_fullscreen();
+ resize(vo_dwidth, vo_dheight);
+#else
vo_x11_fullscreen();
+#endif
return VO_TRUE;
case VOCTRL_GET_PANSCAN:
if (!use_aspect) return VO_NOTIMPL;
diff --git a/libvo/w32_common.c b/libvo/w32_common.c
index c23afe679d..6e04fe199e 100644
--- a/libvo/w32_common.c
+++ b/libvo/w32_common.c
@@ -180,7 +180,7 @@ int createRenderingContext(void) {
updateScreenProperties();
vo_dwidth = vo_fs ? vo_screenwidth : o_dwidth;
vo_dheight = vo_fs ? vo_screenheight : o_dheight;
- SetWindowPos(vo_window, layer, vo_dx, vo_dy, vo_dwidth, vo_dheight, SWP_SHOWWINDOW);
+ SetWindowPos(vo_window, layer, vo_fs ? 0 : vo_dx, vo_fs ? 0 : vo_dy, vo_dwidth, vo_dheight, SWP_SHOWWINDOW);
PIXELFORMATDESCRIPTOR pfd;
memset(&pfd, 0, sizeof pfd);
diff --git a/libvo/w32_common.h b/libvo/w32_common.h
index 75a9420826..9d2cf2773f 100644
--- a/libvo/w32_common.h
+++ b/libvo/w32_common.h
@@ -11,6 +11,7 @@ extern int vo_ontop;
extern int vo_init(void);
extern void vo_w32_uninit(void);
+extern void vo_w32_ontop(void);
extern void vo_w32_fullscreen(void);
extern int vo_w32_check_events(void);
extern int createRenderingContext(void);