Mercurial > mplayer.hg
comparison libvo/vo_gl.c @ 36219:673719da1a92
Extract window creation code to common file.
author | reimar |
---|---|
date | Sun, 09 Jun 2013 18:33:21 +0000 |
parents | c2ca616ffd53 |
children | b67bdb9304f8 |
comparison
equal
deleted
inserted
replaced
36218:c2ca616ffd53 | 36219:673719da1a92 |
---|---|
661 | 661 |
662 static int create_window(uint32_t d_width, uint32_t d_height, uint32_t flags, const char *title) | 662 static int create_window(uint32_t d_width, uint32_t d_height, uint32_t flags, const char *title) |
663 { | 663 { |
664 if (stereo_mode == GL_3D_QUADBUFFER) | 664 if (stereo_mode == GL_3D_QUADBUFFER) |
665 flags |= VOFLAG_STEREO; | 665 flags |= VOFLAG_STEREO; |
666 #ifdef CONFIG_GL_WIN32 | |
667 if (glctx.type == GLTYPE_W32 && !vo_w32_config(d_width, d_height, flags)) | |
668 return -1; | |
669 #endif | |
670 #ifdef CONFIG_GL_OSX | |
671 if (glctx.type == GLTYPE_OSX && !vo_osx_config(d_width, d_height, flags)) | |
672 return -1; | |
673 #endif | |
674 #ifdef CONFIG_GL_EGL_X11 | |
675 if (glctx.type == GLTYPE_EGL_X11) { | |
676 XVisualInfo vinfo = { .visual = CopyFromParent, .depth = CopyFromParent }; | |
677 vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height, flags, | |
678 CopyFromParent, "gl", title); | |
679 } | |
680 #endif | |
681 #ifdef CONFIG_GL_X11 | |
682 if (glctx.type == GLTYPE_X11) { | |
683 static int default_glx_attribs[] = { | |
684 GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, | |
685 GLX_DOUBLEBUFFER, None | |
686 }; | |
687 static int stereo_glx_attribs[] = { | |
688 GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, | |
689 GLX_DOUBLEBUFFER, GLX_STEREO, None | |
690 }; | |
691 XVisualInfo *vinfo = NULL; | |
692 if (stereo_mode == GL_3D_QUADBUFFER) { | |
693 vinfo = glXChooseVisual(mDisplay, mScreen, stereo_glx_attribs); | |
694 if (!vinfo) | |
695 mp_msg(MSGT_VO, MSGL_ERR, "[gl] Could not find a stereo visual, " | |
696 "3D will probably not work!\n"); | |
697 } | |
698 if (!vinfo) | |
699 vinfo = glXChooseVisual(mDisplay, mScreen, default_glx_attribs); | |
700 if (!vinfo) { | |
701 mp_msg(MSGT_VO, MSGL_ERR, "[gl] no GLX support present\n"); | |
702 return -1; | |
703 } | |
704 mp_msg(MSGT_VO, MSGL_V, "[gl] GLX chose visual with ID 0x%x\n", (int)vinfo->visualid); | |
705 | |
706 vo_x11_create_vo_window(vinfo, vo_dx, vo_dy, d_width, d_height, flags, | |
707 XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone), | |
708 "gl", title); | |
709 } | |
710 #endif | |
711 #ifdef CONFIG_GL_SDL | 666 #ifdef CONFIG_GL_SDL |
712 if (glctx.type == GLTYPE_SDL) { | 667 if (glctx.type == GLTYPE_SDL) { |
713 // Ugly to do this here, but SDL ignores it if set later | 668 // Ugly to do this here, but SDL ignores it if set later |
714 if (swap_interval >= 0) { | 669 if (swap_interval >= 0) { |
715 #if SDL_VERSION_ATLEAST(1, 3, 0) | 670 #if SDL_VERSION_ATLEAST(1, 3, 0) |
716 SDL_GL_SetSwapInterval(swap_interval); | 671 SDL_GL_SetSwapInterval(swap_interval); |
717 #elif SDL_VERSION_ATLEAST(1, 2, 10) | 672 #elif SDL_VERSION_ATLEAST(1, 2, 10) |
718 SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, swap_interval); | 673 SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, swap_interval); |
719 #endif | 674 #endif |
720 } | 675 } |
721 if (!vo_sdl_config(d_width, d_height, flags, title)) | |
722 return -1; | |
723 } | 676 } |
724 #endif | 677 #endif |
725 return 0; | 678 return mpglcontext_create_window(&glctx, d_width, d_height, flags, title); |
726 } | 679 } |
727 | 680 |
728 #ifdef CONFIG_GL_OSX | 681 #ifdef CONFIG_GL_OSX |
729 static void osx_redraw(void) | 682 static void osx_redraw(void) |
730 { | 683 { |