comparison libvo/vo_gl2.c @ 12750:38c660174053

removed XFlush() before XSync(), made config_glx return-type signed, force 32bit on Darwin, idea from a patch by Marc Hoffman (mmh <at> pleasantst.com).
author reimar
date Fri, 02 Jul 2004 16:18:24 +0000
parents bd90b887fb13
children cf8979836dc5
comparison
equal deleted inserted replaced
12749:86774b3d5ede 12750:38c660174053
39 #include "aspect.h" 39 #include "aspect.h"
40 40
41 #define NDEBUG 41 #define NDEBUG
42 //#undef NDEBUG 42 //#undef NDEBUG
43 43
44 #undef TEXTUREFORMAT_ALWAYS_RGB24 44 #undef TEXTUREFORMAT_ALWAYS
45 #undef TEXTUREFORMAT_ALWAYS_S
46 #ifdef SYS_DARWIN
47 #define TEXTUREFORMAT_ALWAYS GL_RGB8
48 #define TEXTUREFORMAT_ALWAYS_S "GL_RGB8"
49 #endif
45 50
46 static vo_info_t info = 51 static vo_info_t info =
47 { 52 {
48 "X11 (OpenGL) - multiple textures version", 53 "X11 (OpenGL) - multiple textures version",
49 "gl2", 54 "gl2",
660 if (best_weight < 1000000) *res_vi = vi_list[best_i]; 665 if (best_weight < 1000000) *res_vi = vi_list[best_i];
661 XFree(vi_list); 666 XFree(vi_list);
662 return (best_weight < 1000000) ? 0 : -1; 667 return (best_weight < 1000000) ? 0 : -1;
663 } 668 }
664 669
665 static uint32_t config_glx(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) { 670 static int config_glx(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) {
666 XSizeHints hint; 671 XSizeHints hint;
667 XVisualInfo *vinfo, vinfo_buf; 672 XVisualInfo *vinfo, vinfo_buf;
668 XEvent xev; 673 XEvent xev;
669 674
670 hint.x = 0; 675 hint.x = 0;
738 743
739 wsGLXContext=glXCreateContext( mDisplay,vinfo,NULL,True ); 744 wsGLXContext=glXCreateContext( mDisplay,vinfo,NULL,True );
740 745
741 glXMakeCurrent( mDisplay,vo_window,wsGLXContext ); 746 glXMakeCurrent( mDisplay,vo_window,wsGLXContext );
742 747
743 XFlush(mDisplay);
744 XSync(mDisplay, False); 748 XSync(mDisplay, False);
745 749
746 //XSelectInput(mDisplay, vo_window, StructureNotifyMask); // !!!! 750 //XSelectInput(mDisplay, vo_window, StructureNotifyMask); // !!!!
747 vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask 751 vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
748 | ButtonPressMask | ButtonReleaseMask | ExposureMask 752 | ButtonPressMask | ButtonReleaseMask | ExposureMask
759 763
760 return 0; 764 return 0;
761 } 765 }
762 766
763 #ifdef HAVE_NEW_GUI 767 #ifdef HAVE_NEW_GUI
764 static uint32_t config_glx_gui(uint32_t d_width, uint32_t d_height) { 768 static int config_glx_gui(uint32_t d_width, uint32_t d_height) {
765 XWindowAttributes xw_attr; 769 XWindowAttributes xw_attr;
766 XVisualInfo *vinfo, vinfo_template; 770 XVisualInfo *vinfo, vinfo_template;
767 int tmp; 771 int tmp;
768 vo_dwidth = d_width; 772 vo_dwidth = d_width;
769 vo_dheight = d_height; 773 vo_dheight = d_height;
778 mp_msg(MSGT_VO, MSGL_FATAL, "[gl2] Could not create GLX context!\n"); 782 mp_msg(MSGT_VO, MSGL_FATAL, "[gl2] Could not create GLX context!\n");
779 XFree(vinfo); 783 XFree(vinfo);
780 return -1; 784 return -1;
781 } 785 }
782 glXMakeCurrent( mDisplay,vo_window,wsGLXContext ); 786 glXMakeCurrent( mDisplay,vo_window,wsGLXContext );
783 XFlush(mDisplay);
784 XSync(mDisplay, False); 787 XSync(mDisplay, False);
785 788
786 if (glXGetConfig(mDisplay,vinfo,GLX_RED_SIZE, &r_sz) != 0) r_sz = 0; 789 if (glXGetConfig(mDisplay,vinfo,GLX_RED_SIZE, &r_sz) != 0) r_sz = 0;
787 if (glXGetConfig(mDisplay,vinfo,GLX_GREEN_SIZE, &g_sz) != 0) g_sz = 0; 790 if (glXGetConfig(mDisplay,vinfo,GLX_GREEN_SIZE, &g_sz) != 0) g_sz = 0;
788 if (glXGetConfig(mDisplay,vinfo,GLX_BLUE_SIZE, &b_sz) != 0) b_sz = 0; 791 if (glXGetConfig(mDisplay,vinfo,GLX_BLUE_SIZE, &b_sz) != 0) b_sz = 0;
939 } else { 942 } else {
940 gl_internal_format=GL_RGB; 943 gl_internal_format=GL_RGB;
941 gl_internal_format_s="GL_RGB"; 944 gl_internal_format_s="GL_RGB";
942 } 945 }
943 946
944 #ifdef TEXTUREFORMAT_ALWAYS_RGB24 947 #ifdef TEXTUREFORMAT_ALWAYS
945 gl_internal_format=GL_RGB8; 948 gl_internal_format=TEXTURE_FORMAT_ALWAYS;
946 gl_internal_format_s="GL_RGB8"; 949 gl_internal_format_s=TEXTURE_FORMAT_ALWAYS_S;
947 #endif 950 #endif
948 951
949 if (IMGFMT_IS_BGR(format)) 952 if (IMGFMT_IS_BGR(format))
950 { 953 {
951 image_mode=MODE_BGR; 954 image_mode=MODE_BGR;
1154 1157
1155 static uint32_t 1158 static uint32_t
1156 query_format(uint32_t format) 1159 query_format(uint32_t format)
1157 { 1160 {
1158 switch(format){ 1161 switch(format){
1162 #ifdef SYS_DARWIN
1163 case IMGFMT_RGB32:
1164 #else
1159 case IMGFMT_RGB24: 1165 case IMGFMT_RGB24:
1160 case IMGFMT_BGR24: 1166 case IMGFMT_BGR24:
1161 // case IMGFMT_RGB32: 1167 // case IMGFMT_RGB32:
1162 // case IMGFMT_BGR32: 1168 // case IMGFMT_BGR32:
1169 #endif
1163 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD; 1170 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD;
1164 } 1171 }
1165 return 0; 1172 return 0;
1166 } 1173 }
1167 1174