comparison libvo/vo_gl.c @ 16268:d7856c2232d0

automatic vsync enabling for vo_gl.
author reimar
date Fri, 19 Aug 2005 09:31:02 +0000
parents 87da68468e6d
children 03884f9a35cc
comparison
equal deleted inserted replaced
16267:c2e581684e17 16268:d7856c2232d0
60 static int err_shown; 60 static int err_shown;
61 static uint32_t image_width; 61 static uint32_t image_width;
62 static uint32_t image_height; 62 static uint32_t image_height;
63 static int many_fmts; 63 static int many_fmts;
64 static int use_glFinish; 64 static int use_glFinish;
65 static int swap_interval;
65 static GLenum gl_target; 66 static GLenum gl_target;
66 static GLenum gl_texfmt; 67 static GLenum gl_texfmt;
67 static GLenum gl_format; 68 static GLenum gl_format;
68 static GLenum gl_type; 69 static GLenum gl_type;
69 static GLint gl_buffer; 70 static GLint gl_buffer;
147 148
148 resize(d_width, d_height); 149 resize(d_width, d_height);
149 150
150 glClearColor( 0.0f,0.0f,0.0f,0.0f ); 151 glClearColor( 0.0f,0.0f,0.0f,0.0f );
151 glClear( GL_COLOR_BUFFER_BIT ); 152 glClear( GL_COLOR_BUFFER_BIT );
153 if (SwapInterval)
154 SwapInterval(swap_interval);
152 gl_buffer = 0; 155 gl_buffer = 0;
153 gl_buffersize = 0; 156 gl_buffersize = 0;
154 err_shown = 0; 157 err_shown = 0;
155 return 1; 158 return 1;
156 } 159 }
517 {"scaled-osd", OPT_ARG_BOOL, &scaled_osd, NULL}, 520 {"scaled-osd", OPT_ARG_BOOL, &scaled_osd, NULL},
518 {"aspect", OPT_ARG_BOOL, &use_aspect, NULL}, 521 {"aspect", OPT_ARG_BOOL, &use_aspect, NULL},
519 {"slice-height", OPT_ARG_INT, &slice_height, (opt_test_f)int_non_neg}, 522 {"slice-height", OPT_ARG_INT, &slice_height, (opt_test_f)int_non_neg},
520 {"rectangle", OPT_ARG_INT, &use_rectangle,(opt_test_f)int_non_neg}, 523 {"rectangle", OPT_ARG_INT, &use_rectangle,(opt_test_f)int_non_neg},
521 {"glfinish", OPT_ARG_BOOL, &use_glFinish, NULL}, 524 {"glfinish", OPT_ARG_BOOL, &use_glFinish, NULL},
525 {"swapinterval", OPT_ARG_INT, &swap_interval,NULL},
522 {NULL} 526 {NULL}
523 }; 527 };
524 528
525 static int preinit(const char *arg) 529 static int preinit(const char *arg)
526 { 530 {
529 use_osd = 1; 533 use_osd = 1;
530 scaled_osd = 0; 534 scaled_osd = 0;
531 use_aspect = 1; 535 use_aspect = 1;
532 use_rectangle = 0; 536 use_rectangle = 0;
533 use_glFinish = 0; 537 use_glFinish = 0;
538 swap_interval = 1;
534 slice_height = 4; 539 slice_height = 4;
535 if (subopt_parse(arg, subopts) != 0) { 540 if (subopt_parse(arg, subopts) != 0) {
536 mp_msg(MSGT_VO, MSGL_FATAL, 541 mp_msg(MSGT_VO, MSGL_FATAL,
537 "\n-vo gl command line help:\n" 542 "\n-vo gl command line help:\n"
538 "Example: mplayer -vo gl:slice-height=4\n" 543 "Example: mplayer -vo gl:slice-height=4\n"
549 " 0: use power-of-two textures\n" 554 " 0: use power-of-two textures\n"
550 " 1: use texture_rectangle\n" 555 " 1: use texture_rectangle\n"
551 " 2: use texture_non_power_of_two\n" 556 " 2: use texture_non_power_of_two\n"
552 " glfinish\n" 557 " glfinish\n"
553 " Call glFinish() before swapping buffers\n" 558 " Call glFinish() before swapping buffers\n"
559 " swapinterval=<n>\n"
560 " Interval in displayed frames between to buffer swaps.\n"
561 " 1 is equivalent to enable VSYNC, 0 to disable VSYNC.\n"
562 " Requires GLX_SGI_swap_control support to work.\n"
554 "\n" ); 563 "\n" );
555 return -1; 564 return -1;
556 } 565 }
557 if (use_rectangle == 1) 566 if (use_rectangle == 1)
558 gl_target = GL_TEXTURE_RECTANGLE; 567 gl_target = GL_TEXTURE_RECTANGLE;