comparison libvo/vo_gl.c @ 17220:a27e52b838e3

support negative stride (flipping) in vo_gl.
author reimar
date Sun, 18 Dec 2005 12:04:08 +0000
parents f650267ecc3a
children f580a7755ac5
comparison
equal deleted inserted replaced
17219:fde45c312c31 17220:a27e52b838e3
88 static int eq_ggamma = 0; 88 static int eq_ggamma = 0;
89 static int eq_bgamma = 0; 89 static int eq_bgamma = 0;
90 90
91 static int texture_width; 91 static int texture_width;
92 static int texture_height; 92 static int texture_height;
93 static int mpi_flipped;
93 94
94 static unsigned int slice_height = 1; 95 static unsigned int slice_height = 1;
95 96
96 static void resize(int x,int y){ 97 static void resize(int x,int y){
97 mp_msg(MSGT_VO, MSGL_V, "[gl] Resize: %dx%d\n",x,y); 98 mp_msg(MSGT_VO, MSGL_V, "[gl] Resize: %dx%d\n",x,y);
471 glNewList(osdDispList[osdtexCnt], GL_COMPILE); 472 glNewList(osdDispList[osdtexCnt], GL_COMPILE);
472 #ifndef FAST_OSD 473 #ifndef FAST_OSD
473 // render alpha 474 // render alpha
474 glBlendFunc(GL_ZERO, GL_SRC_ALPHA); 475 glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
475 BindTexture(gl_target, osdatex[osdtexCnt]); 476 BindTexture(gl_target, osdatex[osdtexCnt]);
476 glDrawTex(x0, y0, w, h, 0, 0, w, h, sx, sy, use_rectangle == 1, 0); 477 glDrawTex(x0, y0, w, h, 0, 0, w, h, sx, sy, use_rectangle == 1, 0, 0);
477 #endif 478 #endif
478 // render OSD 479 // render OSD
479 glBlendFunc (GL_ONE, GL_ONE); 480 glBlendFunc (GL_ONE, GL_ONE);
480 BindTexture(gl_target, osdtex[osdtexCnt]); 481 BindTexture(gl_target, osdtex[osdtexCnt]);
481 glDrawTex(x0, y0, w, h, 0, 0, w, h, sx, sy, use_rectangle == 1, 0); 482 glDrawTex(x0, y0, w, h, 0, 0, w, h, sx, sy, use_rectangle == 1, 0, 0);
482 glEndList(); 483 glEndList();
483 484
484 osdtexCnt++; 485 osdtexCnt++;
485 } 486 }
486 487
506 if (image_format == IMGFMT_YV12) 507 if (image_format == IMGFMT_YV12)
507 glEnableYUVConversion(gl_target, use_yuv); 508 glEnableYUVConversion(gl_target, use_yuv);
508 glDrawTex(0, 0, image_width, image_height, 509 glDrawTex(0, 0, image_width, image_height,
509 0, 0, image_width, image_height, 510 0, 0, image_width, image_height,
510 texture_width, texture_height, 511 texture_width, texture_height,
511 use_rectangle == 1, image_format == IMGFMT_YV12); 512 use_rectangle == 1, image_format == IMGFMT_YV12, mpi_flipped);
512 if (image_format == IMGFMT_YV12) 513 if (image_format == IMGFMT_YV12)
513 glDisableYUVConversion(gl_target, use_yuv); 514 glDisableYUVConversion(gl_target, use_yuv);
514 515
515 if (osdtexCnt > 0) { 516 if (osdtexCnt > 0) {
516 // set special rendering parameters 517 // set special rendering parameters
542 } 543 }
543 544
544 //static inline uint32_t draw_slice_x11(uint8_t *src[], uint32_t slice_num) 545 //static inline uint32_t draw_slice_x11(uint8_t *src[], uint32_t slice_num)
545 static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) 546 static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
546 { 547 {
548 mpi_flipped = (stride[0] < 0);
547 glUploadTex(gl_target, gl_format, gl_type, src[0], stride[0], 549 glUploadTex(gl_target, gl_format, gl_type, src[0], stride[0],
548 x, y, w, h, slice_height); 550 x, y, w, h, slice_height);
549 if (image_format == IMGFMT_YV12) { 551 if (image_format == IMGFMT_YV12) {
550 ActiveTexture(GL_TEXTURE1); 552 ActiveTexture(GL_TEXTURE1);
551 glUploadTex(gl_target, gl_format, gl_type, src[1], stride[1], 553 glUploadTex(gl_target, gl_format, gl_type, src[1], stride[1],
610 data = NULL; 612 data = NULL;
611 BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer); 613 BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer);
612 UnmapBuffer(GL_PIXEL_UNPACK_BUFFER); 614 UnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
613 slice = 0; // always "upload" full texture 615 slice = 0; // always "upload" full texture
614 } 616 }
617 mpi_flipped = (mpi->stride[0] < 0);
615 glUploadTex(gl_target, gl_format, gl_type, data, mpi->stride[0], 618 glUploadTex(gl_target, gl_format, gl_type, data, mpi->stride[0],
616 mpi->x, mpi->y, mpi->w, mpi->h, slice); 619 mpi->x, mpi->y, mpi->w, mpi->h, slice);
617 if (mpi->imgfmt == IMGFMT_YV12) { 620 if (mpi->imgfmt == IMGFMT_YV12) {
618 data += mpi->planes[1] - mpi->planes[0]; 621 data += mpi->planes[1] - mpi->planes[0];
619 ActiveTexture(GL_TEXTURE1); 622 ActiveTexture(GL_TEXTURE1);