summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rwxr-xr-xconfigure20
-rw-r--r--libvo/matrixview.c383
-rw-r--r--libvo/matrixview.h32
-rw-r--r--libvo/video_out.c6
-rw-r--r--libvo/vo_gl2.c935
-rw-r--r--libvo/vo_matrixview.c324
7 files changed, 1 insertions, 1702 deletions
diff --git a/Makefile b/Makefile
index e9a28e2d80..a0a6edb51f 100644
--- a/Makefile
+++ b/Makefile
@@ -455,11 +455,10 @@ SRCS_MPLAYER-$(FFMPEG) += libvo/vo_png.c
SRCS_MPLAYER-$(GGI) += libvo/vo_ggi.c
SRCS_MPLAYER-$(GIF) += libvo/vo_gif89a.c
SRCS_MPLAYER-$(GL) += libvo/gl_common.c libvo/vo_gl.c \
- libvo/vo_gl2.c pnm_loader.c
+ pnm_loader.c
SRCS_MPLAYER-$(GL_SDL) += libvo/sdl_common.c
SRCS_MPLAYER-$(GL_WIN32) += libvo/w32_common.c
SRCS_MPLAYER-$(GL_X11) += libvo/x11_common.c
-SRCS_MPLAYER-$(MATRIXVIEW) += libvo/vo_matrixview.c libvo/matrixview.c
SRCS_MPLAYER-$(IVTV) += libao2/ao_ivtv.c libvo/vo_ivtv.c
SRCS_MPLAYER-$(JACK) += libao2/ao_jack.c
diff --git a/configure b/configure
index 0de4c2d89e..f79b8cec08 100755
--- a/configure
+++ b/configure
@@ -381,7 +381,6 @@ Codecs:
Video output:
--enable-gl enable OpenGL video output [autodetect]
- --disable-matrixview disable OpenGL MatrixView video output [autodetect]
--enable-dga2 enable DGA 2 support [autodetect]
--enable-dga1 enable DGA 1 support [autodetect]
--enable-vesa enable VESA video output [autodetect]
@@ -573,7 +572,6 @@ _md5sum=yes
_yuv4mpeg=yes
_gif=auto
_gl=auto
-matrixview=yes
_ggi=auto
_ggiwmh=auto
_aa=auto
@@ -879,8 +877,6 @@ for ac_option do
--disable-gif) _gif=no ;;
--enable-gl) _gl=yes ;;
--disable-gl) _gl=no ;;
- --enable-matrixview) matrixview=yes ;;
- --disable-matrixview) matrixview=no ;;
--enable-ggi) _ggi=yes ;;
--disable-ggi) _ggi=no ;;
--enable-ggiwmh) _ggiwmh=yes ;;
@@ -4572,20 +4568,6 @@ fi
echores "$_gl"
-echocheck "MatrixView"
-if test "$_gl" = no ; then
- matrixview=no
-fi
-if test "$matrixview" = yes ; then
- vomodules="matrixview $vomodules"
- def_matrixview='#define CONFIG_MATRIXVIEW 1'
-else
- novomodules="matrixview $novomodules"
- def_matrixview='#undef CONFIG_MATRIXVIEW'
-fi
-echores "$matrixview"
-
-
if os2 ; then
echocheck "KVA (SNAP/WarpOverlay!/DIVE)"
if test "$_kva" = auto; then
@@ -6717,7 +6699,6 @@ GL = $_gl
GL_WIN32 = $_gl_win32
GL_X11 = $_gl_x11
GL_SDL = $_gl_sdl
-MATRIXVIEW = $matrixview
HAVE_POSIX_SELECT = $_posix_select
HAVE_SYS_MMAN_H = $_mman
IVTV = $_ivtv
@@ -7126,7 +7107,6 @@ $def_gl
$def_gl_win32
$def_gl_x11
$def_gl_sdl
-$def_matrixview
$def_ivtv
$def_jpeg
$def_kva
diff --git a/libvo/matrixview.c b/libvo/matrixview.c
deleted file mode 100644
index 0aa43e5303..0000000000
--- a/libvo/matrixview.c
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Copyright (C) 2003 Alex Zolotov <nightradio@knoppix.ru>
- * Mucked with by Tugrul Galatali <tugrul@galatali.com>
- *
- * MatrixView is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MatrixView is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MatrixView; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/**
- * Ported to an MPlayer video out plugin by Pigeon <pigeon at pigeond.net>
- * August 2006
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include "gl_common.h"
-#include "matrixview.h"
-#include "matrixview_font.h"
-
-static float matrix_contrast = 1.5;
-static float matrix_brightness = 1.0;
-
-// Settings for our light. Try playing with these (or add more lights).
-static float Light_Ambient[] = { 0.1f, 0.1f, 0.1f, 1.0f };
-static float Light_Diffuse[] = { 1.2f, 1.2f, 1.2f, 1.0f };
-static float Light_Position[] = { 2.0f, 2.0f, 0.0f, 1.0f };
-
-static const uint8_t flare[4][4] = {
- { 0, 0, 0, 0},
- { 0, 180, 0, 0},
- { 0, 0, 0, 0},
- { 0, 0, 0, 0}
-};
-
-#define MAX_TEXT_X 0x4000
-#define MAX_TEXT_Y 0x4000
-static int text_x = 0;
-static int text_y = 0;
-#define _text_x text_x/2
-#define _text_y text_y/2
-
-// Scene position
-#define Z_Off -128.0f
-#define Z_Depth 8
-
-static uint8_t *speed;
-static uint8_t *text;
-static uint8_t *text_light;
-static float *text_depth;
-
-static float *bump_pic;
-
-static void draw_char(int num, float light, float x, float y, float z)
-{
- float tx, ty;
- int num2, num3;
-
- num &= 63;
- //light = light / 255; //light=7-light;num+=(light*60);
- light = light / 255 * matrix_brightness;
- num2 = num / 10;
- num3 = num - (num2 * 10);
- ty = (float)num2 / 7;
- tx = (float)num3 / 10;
- mpglNormal3f(0.0f, 0.0f, 1.0f); // Needed for lighting
- mpglColor4f(0.0, 1.0, 0.0, light); // Basic polygon color
-
- mpglTexCoord2f(tx, ty);
- mpglVertex3f(x, y, z);
- mpglTexCoord2f(tx + 0.1, ty);
- mpglVertex3f(x + 1, y, z);
- mpglTexCoord2f(tx + 0.1, ty + 0.166);
- mpglVertex3f(x + 1, y - 1, z);
- mpglTexCoord2f(tx, ty + 0.166);
- mpglVertex3f(x, y - 1, z);
-}
-
-static void draw_illuminatedchar(int num, float x, float y, float z)
-{
- float tx, ty;
- int num2, num3;
-
- num2 = num / 10;
- num3 = num - (num2 * 10);
- ty = (float)num2 / 7;
- tx = (float)num3 / 10;
- mpglNormal3f(0.0f, 0.0f, 1.0f); // Needed for lighting
- mpglColor4f(1.0, 1.0, 1.0, .5); // Basic polygon color
-
- mpglTexCoord2f(tx, ty);
- mpglVertex3f(x, y, z);
- mpglTexCoord2f(tx + 0.1, ty);
- mpglVertex3f(x + 1, y, z);
- mpglTexCoord2f(tx + 0.1, ty + 0.166);
- mpglVertex3f(x + 1, y - 1, z);
- mpglTexCoord2f(tx, ty + 0.166);
- mpglVertex3f(x, y - 1, z);
-}
-
-static void draw_flare(float x, float y, float z) //flare
-{
- mpglNormal3f(0.0f, 0.0f, 1.0f); // Needed for lighting
- mpglColor4f(1.0, 1.0, 1.0, .8); // Basic polygon color
-
- mpglTexCoord2f(0, 0);
- mpglVertex3f(x - 1, y + 1, z);
- mpglTexCoord2f(0.75, 0);
- mpglVertex3f(x + 2, y + 1, z);
- mpglTexCoord2f(0.75, 0.75);
- mpglVertex3f(x + 2, y - 2, z);
- mpglTexCoord2f(0, 0.75);
- mpglVertex3f(x - 1, y - 2, z);
-}
-
-static void draw_text(uint8_t *pic)
-{
- int x, y;
- int p = 0;
- int c, c_pic;
- int pic_fade = 255;
-
- for (y = _text_y; y > -_text_y; y--) {
- for (x = -_text_x; x < _text_x; x++) {
- c = text_light[p] - (text[p] >> 1);
- c += pic_fade;
- if (c > 255)
- c = 255;
-
- if (pic) {
- // Original code
- //c_pic = pic[p] * matrix_contrast - (255 - pic_fade);
-
- c_pic = (255 - pic[p]) * matrix_contrast - (255 - pic_fade);
-
- if (c_pic < 0)
- c_pic = 0;
-
- c -= c_pic;
-
- if (c < 0)
- c = 0;
-
- bump_pic[p] = (255.0f - c_pic) / (256 / Z_Depth);
- } else {
- bump_pic[p] = Z_Depth;
- }
-
- if (text[p] && c > 10)
- draw_char(text[p] + 1, c, x, y, text_depth[p] + bump_pic[p]);
-
- if (text_depth[p] < 0.1)
- text_depth[p] = 0;
- else
- text_depth[p] /= 1.1;
-
- if (text_light[p] > 128 && text_light[p + text_x] < 10)
- draw_illuminatedchar(text[p] + 1, x, y,
- text_depth[p] + bump_pic[p]);
-
- p++;
- }
- }
-}
-
-static void draw_flares(void)
-{
- float x, y;
- int p = 0;
-
- for (y = _text_y; y > -_text_y; y--) {
- for (x = -_text_x; x < _text_x; x++) {
- if (text_light[p] > 128 && text_light[p + text_x] < 10)
- draw_flare(x, y, text_depth[p] + bump_pic[p]);
- p++;
- }
- }
-}
-
-static void scroll(double dCurrentTime)
-{
- int a, s, polovina;
- //static double dLastCycle = -1;
- static double dLastMove = -1;
-
- if (dCurrentTime - dLastMove > 1.0 / (text_y / 1.5)) {
- dLastMove = dCurrentTime;
-
- polovina = text_x * text_y / 2;
- s = 0;
- for (a = text_x * text_y + text_x - 1; a >= text_x; a--) {
- if (speed[s])
- text_light[a] = text_light[a - text_x]; //scroll light table down
- s++;
- if (s >= text_x)
- s = 0;
- }
- memmove(text_light + text_x, text_light, text_x * text_y);
- memset(text_light, 253, text_x);
-
- s = 0;
- for (a = polovina; a < text_x * text_y; a++) {
- if (text_light[a] == 255)
- text_light[s] = text_light[s + text_x] >> 1; //make black bugs in top line
-
- s++;
-
- if (s >= text_x)
- s = 0;
- }
- }
-}
-
-static void make_change(double dCurrentTime)
-{
- int r = rand() % text_x * text_y;
-
- text[r] += 133; //random bugs
-
- r = rand() % (4 * text_x);
- if (r < text_x && text_light[r])
- text_light[r] = 255; //white bugs
-
- scroll (dCurrentTime);
-}
-
-
-static void make_text(void)
-{
- int a;
-
- for (a = 0; a < text_x * text_y; a++)
- text[a] = rand() >> 8; // avoid the lowest bits of rand()
-
- for (a = 0; a < text_x; a++)
- speed[a] = rand() >= RAND_MAX / 2;
-}
-
-static void ourBuildTextures(void)
-{
- mpglTexImage2D(GL_TEXTURE_2D, 0, 1, 128, 64, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE,
- font_texture);
- mpglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- mpglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- mpglBindTexture(GL_TEXTURE_2D, 1);
- mpglTexImage2D(GL_TEXTURE_2D, 0, 1, 4, 4, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE,
- flare);
- mpglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- mpglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- // Some pretty standard settings for wrapping and filtering.
- mpglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- mpglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- mpglBindTexture(GL_TEXTURE_2D, 0);
-}
-
-void matrixview_init(int w, int h)
-{
- make_text();
-
- ourBuildTextures();
-
- // Color to clear color buffer to.
- mpglClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-
- // Depth to clear depth buffer to; type of test.
- mpglClearDepth(1.0);
- mpglDepthFunc(GL_LESS);
-
- // Enables Smooth Color Shading; try GL_FLAT for (lack of) fun.
- mpglShadeModel(GL_SMOOTH);
-
- // Set up a light, turn it on.
- mpglLightfv(GL_LIGHT1, GL_POSITION, Light_Position);
- mpglLightfv(GL_LIGHT1, GL_AMBIENT, Light_Ambient);
- mpglLightfv(GL_LIGHT1, GL_DIFFUSE, Light_Diffuse);
- mpglEnable(GL_LIGHT1);
-
- // A handy trick -- have surface material mirror the color.
- mpglColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
- mpglEnable(GL_COLOR_MATERIAL);
-
- // Allow adjusting of texture color via glColor
- mpglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- matrixview_reshape(w, h);
-}
-
-
-void matrixview_reshape(int w, int h)
-{
- mpglViewport(0, 0, w, h);
-
- mpglMatrixMode(GL_PROJECTION);
- mpglLoadIdentity();
- mpglFrustum(-_text_x, _text_x, -_text_y, _text_y, -Z_Off - Z_Depth, -Z_Off);
-
- mpglMatrixMode(GL_MODELVIEW);
-}
-
-
-void matrixview_draw(int w, int h, double currentTime, float frameTime,
- uint8_t *data)
-{
- mpglEnable(GL_BLEND);
- mpglEnable(GL_TEXTURE_2D);
-
- mpglDisable(GL_LIGHTING);
- mpglBlendFunc(GL_SRC_ALPHA, GL_ONE);
- mpglDisable(GL_DEPTH_TEST);
-
- mpglMatrixMode(GL_MODELVIEW);
- mpglLoadIdentity();
- mpglTranslated(0.0f, 0.0f, Z_Off);
-
- // Clear the color and depth buffers.
- mpglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- // OK, let's start drawing our planer quads.
- mpglBegin(GL_QUADS);
- draw_text(data);
- mpglEnd();
-
- mpglBindTexture(GL_TEXTURE_2D, 1);
- mpglBegin(GL_QUADS);
- draw_flares();
- mpglEnd();
- mpglBindTexture(GL_TEXTURE_2D, 0);
-
- make_change(currentTime);
-
- mpglLoadIdentity();
- mpglMatrixMode(GL_PROJECTION);
-}
-
-void matrixview_contrast_set(float contrast)
-{
- matrix_contrast = contrast;
-}
-
-void matrixview_brightness_set(float brightness)
-{
- matrix_brightness = brightness;
-}
-
-
-void matrixview_matrix_resize(int w, int h)
-{
- int elems;
- free(speed);
- speed = NULL;
- free(text);
- text = NULL;
- free(text_light);
- text_light = NULL;
- free(text_depth);
- text_depth = NULL;
- if (w > MAX_TEXT_X || h > MAX_TEXT_Y)
- return;
- elems = w * (h + 1);
- speed = calloc(w, sizeof(*speed));
- text = calloc(elems, sizeof(*text));
- text_light = calloc(elems, sizeof(*text_light));
- text_depth = calloc(elems, sizeof(*text_depth));
- bump_pic = calloc(elems, sizeof(*bump_pic));
- text_x = w;
- text_y = h;
- make_text();
-}
diff --git a/libvo/matrixview.h b/libvo/matrixview.h
deleted file mode 100644
index 5081aa79e7..0000000000
--- a/libvo/matrixview.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_MATRIXVIEW_H
-#define MPLAYER_MATRIXVIEW_H
-
-#include <stdint.h>
-
-void matrixview_init (int w, int h);
-void matrixview_reshape (int w, int h);
-void matrixview_draw (int w, int h, double currentTime, float frameTime,
- uint8_t *data);
-void matrixview_matrix_resize(int w, int h);
-void matrixview_contrast_set(float contrast);
-void matrixview_brightness_set(float brightness);
-
-#endif /* MPLAYER_MATRIXVIEW_H */
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 8b6292978f..3338dbf551 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -84,8 +84,6 @@ extern struct vo_driver video_out_vdpau;
extern struct vo_driver video_out_xv;
extern struct vo_driver video_out_gl_nosw;
extern struct vo_driver video_out_gl;
-extern struct vo_driver video_out_gl2;
-extern struct vo_driver video_out_matrixview;
extern struct vo_driver video_out_dga;
extern struct vo_driver video_out_sdl;
extern struct vo_driver video_out_3dfx;
@@ -181,7 +179,6 @@ const struct vo_driver *video_out_drivers[] =
#endif
#ifdef CONFIG_GL
&video_out_gl,
- &video_out_gl2,
#endif
#ifdef CONFIG_DGA
&video_out_dga,
@@ -196,9 +193,6 @@ const struct vo_driver *video_out_drivers[] =
#ifdef CONFIG_SVGALIB
&video_out_svga,
#endif
-#ifdef CONFIG_MATRIXVIEW
- &video_out_matrixview,
-#endif
#ifdef CONFIG_AA
&video_out_aa,
#endif
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c
deleted file mode 100644
index 6dd9597412..0000000000
--- a/libvo/vo_gl2.c
+++ /dev/null
@@ -1,935 +0,0 @@
-/*
- * X11/OpenGL interface
- * based on video_out_x11 by Aaron Holtzman,
- * and WS opengl window manager by Pontscho/Fresh!
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "subopt-helper.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "sub/sub.h"
-
-#include "gl_common.h"
-#include "aspect.h"
-
-#undef TEXTUREFORMAT_ALWAYS
-#ifdef __APPLE__
-#define TEXTUREFORMAT_ALWAYS GL_RGBA8
-#endif
-
-//! force texture height, useful for debugging
-#define TEXTURE_HEIGHT 128
-#undef TEXTURE_HEIGHT
-//! force texture width, useful for debugging
-#define TEXTURE_WIDTH 128
-#undef TEXTURE_WIDTH
-
-static const vo_info_t info =
-{
- "X11 (OpenGL) - multiple textures version",
- "gl2",
- "Arpad Gereoffy & Sven Goethel",
- ""
-};
-
-const LIBVO_EXTERN(gl2)
-
-/* local data */
-static unsigned char *ImageData=NULL;
-
-static MPGLContext glctx;
-
-static uint32_t image_width;
-static uint32_t image_height;
-static uint32_t image_format;
-static uint32_t image_bpp;
-static uint32_t image_bytes;
-
-static int int_pause;
-
-static uint32_t texture_width;
-static uint32_t texture_height;
-static int texnumx, texnumy, raw_line_len;
-static int texdirty;
-static struct TexSquare * texgrid = NULL;
-static GLuint fragprog;
-static GLuint lookupTex;
-static GLint gl_internal_format;
-static int rgb_sz, r_sz, g_sz, b_sz, a_sz;
-static GLenum gl_bitmap_format;
-static GLenum gl_bitmap_type;
-static int isGL12 = GL_FALSE;
-
-static int gl_bilinear=1;
-static int gl_antialias=0;
-static int use_yuv;
-static int is_yuv;
-static int use_glFinish;
-
-static void (*draw_alpha_fnc)
- (int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride);
-
-
-/* The squares that are tiled to make up the game screen polygon */
-
-struct TexSquare
-{
- GLubyte *texture;
- GLuint texobj;
- GLuint uvtexobjs[2];
- GLfloat fx, fy, fw, fh;
-};
-
-static GLint getInternalFormat(void)
-{
- switch (glctx.type) {
-#ifdef CONFIG_GL_WIN32
- case GLTYPE_W32:
- {
- PIXELFORMATDESCRIPTOR pfd;
- HDC vo_hdc = vo_w32_get_dc(vo_w32_window);
- int pf = GetPixelFormat(vo_hdc);
- if (!DescribePixelFormat(vo_hdc, pf, sizeof pfd, &pfd)) {
- r_sz = g_sz = b_sz = a_sz = 0;
- } else {
- r_sz = pfd.cRedBits;
- g_sz = pfd.cGreenBits;
- b_sz = pfd.cBlueBits;
- a_sz = pfd.cAlphaBits;
- }
- vo_w32_release_dc(vo_w32_window, vo_hdc);
- }
- break;
-#endif
-#ifdef CONFIG_GL_X11
- case GLTYPE_X11:
- if (glXGetConfig(mDisplay, glctx.vinfo.x11, GLX_RED_SIZE, &r_sz) != 0) r_sz = 0;
- if (glXGetConfig(mDisplay, glctx.vinfo.x11, GLX_GREEN_SIZE, &g_sz) != 0) g_sz = 0;
- if (glXGetConfig(mDisplay, glctx.vinfo.x11, GLX_BLUE_SIZE, &b_sz) != 0) b_sz = 0;
- if (glXGetConfig(mDisplay, glctx.vinfo.x11, GLX_ALPHA_SIZE, &a_sz) != 0) a_sz = 0;
- break;
-#endif
- }
-
- rgb_sz=r_sz+g_sz+b_sz;
- if(rgb_sz<=0) rgb_sz=24;
-
-#ifdef TEXTUREFORMAT_ALWAYS
- return TEXTUREFORMAT_ALWAYS;
-#else
- if(r_sz==3 && g_sz==3 && b_sz==2 && a_sz==0)
- return GL_R3_G3_B2;
- if(r_sz==4 && g_sz==4 && b_sz==4 && a_sz==0)
- return GL_RGB4;
- if(r_sz==5 && g_sz==5 && b_sz==5 && a_sz==0)
- return GL_RGB5;
- if(r_sz==8 && g_sz==8 && b_sz==8 && a_sz==0)
- return GL_RGB8;
- if(r_sz==10 && g_sz==10 && b_sz==10 && a_sz==0)
- return GL_RGB10;
- if(r_sz==2 && g_sz==2 && b_sz==2 && a_sz==2)
- return GL_RGBA2;
- if(r_sz==4 && g_sz==4 && b_sz==4 && a_sz==4)
- return GL_RGBA4;
- if(r_sz==5 && g_sz==5 && b_sz==5 && a_sz==1)
- return GL_RGB5_A1;
- if(r_sz==8 && g_sz==8 && b_sz==8 && a_sz==8)
- return GL_RGBA8;
- if(r_sz==10 && g_sz==10 && b_sz==10 && a_sz==2)
- return GL_RGB10_A2;
-#endif
- return GL_RGB;
-}
-
-static int initTextures(void)
-{
- struct TexSquare *tsq=0;
- GLfloat texpercx, texpercy;
- int s;
- int x=0, y=0;
-
- // textures smaller than 64x64 might not be supported
- s=64;
- while (s<image_width)
- s*=2;
- texture_width=s;
-
- s=64;
- while (s<image_height)
- s*=2;
- texture_height=s;
-
- if (!is_yuv)
- gl_internal_format = getInternalFormat();
-
- /* Test the max texture size */
- do {
- GLint w;
- glTexImage2D (GL_PROXY_TEXTURE_2D, 0,
- gl_internal_format,
- texture_width, texture_height,
- 0, gl_bitmap_format, gl_bitmap_type, NULL);
-
- glGetTexLevelParameteriv
- (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
-
- if (w >= texture_width)
- break;
-
- mp_msg (MSGT_VO, MSGL_V, "[gl2] Needed texture [%dx%d] too big, trying ",
- texture_width, texture_height);
-
- if (texture_width > texture_height)
- texture_width /= 2;
- else
- texture_height /= 2;
-
- mp_msg (MSGT_VO, MSGL_V, "[%dx%d] !\n", texture_width, texture_height);
-
- if(texture_width < 64 || texture_height < 64) {
- mp_msg (MSGT_VO, MSGL_FATAL, "[gl2] Give up .. usable texture size not available, or texture config error !\n");
- return -1;
- }
- } while (texture_width > 1 && texture_height > 1);
-#ifdef TEXTURE_WIDTH
- texture_width = TEXTURE_WIDTH;
-#endif
-#ifdef TEXTURE_HEIGHT
- texture_height = TEXTURE_HEIGHT;
-#endif
-
- texnumx = image_width / texture_width;
- if ((image_width % texture_width) > 0)
- texnumx++;
-
- texnumy = image_height / texture_height;
- if ((image_height % texture_height) > 0)
- texnumy++;
-
- mp_msg(MSGT_VO, MSGL_V, "[gl2] Creating %dx%d textures of size %dx%d ...\n",
- texnumx, texnumy, texture_width,texture_height);
-
- /* Allocate the texture memory */
-
- texpercx = (GLfloat) texture_width / (GLfloat) image_width;
- texpercy = (GLfloat) texture_height / (GLfloat) image_height;
-
- free(texgrid);
- texgrid = calloc (texnumx * texnumy, sizeof (struct TexSquare));
-
- raw_line_len = image_width * image_bytes;
-
- mp_msg (MSGT_VO, MSGL_DBG2, "[gl2] texture-usage %d*width=%d, %d*height=%d\n",
- (int) texnumx, (int) texture_width, (int) texnumy,
- (int) texture_height);
-
- tsq = texgrid;
- for (y = 0; y < texnumy; y++) {
- for (x = 0; x < texnumx; x++) {
- tsq->fx = x * texpercx;
- tsq->fy = y * texpercy;
- tsq->fw = texpercx;
- tsq->fh = texpercy;
-
- tsq->texobj=0;
- tsq->uvtexobjs[0] = tsq->uvtexobjs[1] = 0;
-
- glGenTextures (1, &(tsq->texobj));
-
- glBindTexture (GL_TEXTURE_2D, tsq->texobj);
- if (is_yuv) {
- glGenTextures(2, tsq->uvtexobjs);
- mpglActiveTexture(GL_TEXTURE1);
- glBindTexture (GL_TEXTURE_2D, tsq->uvtexobjs[0]);
- mpglActiveTexture(GL_TEXTURE2);
- glBindTexture (GL_TEXTURE_2D, tsq->uvtexobjs[1]);
- mpglActiveTexture(GL_TEXTURE0);
- }
-
- glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, gl_bitmap_format, gl_bitmap_type, GL_LINEAR,
- texture_width, texture_height, 0);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- if (is_yuv) {
- int xs, ys, depth;
- int chroma_clear_val = 128;
- mp_get_chroma_shift(image_format, &xs, &ys, &depth);
- chroma_clear_val >>= -depth & 7;
- mpglActiveTexture(GL_TEXTURE1);
- glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, gl_bitmap_format, gl_bitmap_type, GL_LINEAR,
- texture_width >> xs, texture_height >> ys,
- chroma_clear_val);
- mpglActiveTexture(GL_TEXTURE2);
- glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, gl_bitmap_format, gl_bitmap_type, GL_LINEAR,
- texture_width >> xs, texture_height >> ys,
- chroma_clear_val);
- mpglActiveTexture(GL_TEXTURE0);
- }
-
- tsq++;
- } /* for all texnumx */
- } /* for all texnumy */
-
- return 0;
-}
-
-static void resetTexturePointers(unsigned char *imageSource)
-{
- unsigned char *texdata_start, *line_start;
- struct TexSquare *tsq = texgrid;
- int x=0, y=0;
-
- line_start = (unsigned char *) imageSource;
-
- for (y = 0; y < texnumy; y++) {
- texdata_start = line_start;
- for (x = 0; x < texnumx; x++) {
- tsq->texture = texdata_start;
- texdata_start += texture_width * image_bytes;
- tsq++;
- } /* for all texnumx */
- line_start += texture_height * raw_line_len;
- } /* for all texnumy */
-}
-
-static void gl_set_bilinear (int val)
-{
- int x, y;
-
- if(val>=0)
- gl_bilinear = val;
- else
- gl_bilinear++;
-
- gl_bilinear=gl_bilinear%2;
- /* no mipmap yet .. */
-
- for (y = 0; y < texnumy; y++) {
- for (x = 0; x < texnumx; x++) {
- glBindTexture (GL_TEXTURE_2D, texgrid[y * texnumx + x].texobj);
-
- switch (gl_bilinear) {
- case 0:
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- mp_msg(MSGT_VO, MSGL_INFO, "[gl2] bilinear off\n");
- break;
- case 1:
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- mp_msg(MSGT_VO, MSGL_INFO, "[gl2] bilinear linear\n");
- break;
- case 2:
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_NEAREST);
- mp_msg(MSGT_VO, MSGL_INFO, "[gl2] bilinear mipmap nearest\n");
- break;
- case 3:
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- mp_msg(MSGT_VO, MSGL_INFO, "[gl2] bilinear mipmap linear\n");
- break;
- }
- }
- }
-}
-
-static void gl_set_antialias (int val)
-{
- gl_antialias=val;
-
- if (gl_antialias) {
- glShadeModel (GL_SMOOTH);
- glEnable (GL_POLYGON_SMOOTH);
- glEnable (GL_LINE_SMOOTH);
- glEnable (GL_POINT_SMOOTH);
- mp_msg(MSGT_VO, MSGL_INFO, "[gl2] antialiasing on\n");
- } else {
- glShadeModel (GL_FLAT);
- glDisable (GL_POLYGON_SMOOTH);
- glDisable (GL_LINE_SMOOTH);
- glDisable (GL_POINT_SMOOTH);
- mp_msg(MSGT_VO, MSGL_INFO, "[gl2] antialiasing off\n");
- }
-}
-
-
-static void drawTextureDisplay (void)
-{
- struct TexSquare *square = texgrid;
- int x, y;
-
- glColor3f(1.0,1.0,1.0);
-
- if (is_yuv)
- glEnableYUVConversion(GL_TEXTURE_2D, use_yuv);
- for (y = 0; y < texnumy; y++) {
- int thish = texture_height;
- if (y == texnumy - 1 && image_height % texture_height)
- thish = image_height % texture_height;
- for (x = 0; x < texnumx; x++) {
- int thisw = texture_width;
- if (x == texnumx - 1 && image_width % texture_width)
- thisw = image_width % texture_width;
- glBindTexture (GL_TEXTURE_2D, square->texobj);
- if (is_yuv) {
- mpglActiveTexture(GL_TEXTURE1);
- glBindTexture (GL_TEXTURE_2D, square->uvtexobjs[0]);
- mpglActiveTexture(GL_TEXTURE2);
- glBindTexture (GL_TEXTURE_2D, square->uvtexobjs[1]);
- mpglActiveTexture(GL_TEXTURE0);
- }
-
- if (texdirty) {
- glUploadTex(GL_TEXTURE_2D, gl_bitmap_format, gl_bitmap_type,
- square->texture, image_width * image_bytes,
- 0, 0, thisw, thish, 0);
- }
-
- glDrawTex(square->fx, square->fy, square->fw, square->fh,
- 0, 0, texture_width, texture_height,
- texture_width, texture_height,
- 0, is_yuv, 0);
- square++;
- } /* for all texnumx */
- } /* for all texnumy */
- if (is_yuv)
- glDisableYUVConversion(GL_TEXTURE_2D, use_yuv);
- texdirty = 0;
-}
-
-
-static void resize(int x,int y){
- mp_msg(MSGT_VO,MSGL_V,"[gl2] Resize: %dx%d\n",x,y);
- if(aspect_scaling()) {
- glClear(GL_COLOR_BUFFER_BIT);
- aspect(&x, &y, A_WINZOOM);
- panscan_calc_windowed();
- x += vo_panscan_x;
- y += vo_panscan_y;
- glViewport( (vo_dwidth-x)/2, (vo_dheight-y)/2, x, y);
- } else {
- //aspect(x, y, A_NOZOOM);
- if (WinID >= 0) {
- int left = 0, top = 0, w = x, h = y;
- geometry(&left, &top, &w, &h, vo_dwidth, vo_dheight);
- top = y - h - top;
- glViewport(left, top, w, h);
- } else
- glViewport( 0, 0, x, y );
- }
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho (0, 1, 1, 0, -1.0, 1.0);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-}
-
-static void draw_alpha_32(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
- vo_draw_alpha_rgb32(w,h,src,srca,stride,ImageData+4*(y0*image_width+x0),4*image_width);
-}
-
-static void draw_alpha_24(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
- vo_draw_alpha_rgb24(w,h,src,srca,stride,ImageData+3*(y0*image_width+x0),3*image_width);
-}
-
-static void draw_alpha_16(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
- vo_draw_alpha_rgb16(w,h,src,srca,stride,ImageData+2*(y0*image_width+x0),2*image_width);
-}
-
-static void draw_alpha_15(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
- vo_draw_alpha_rgb15(w,h,src,srca,stride,ImageData+2*(y0*image_width+x0),2*image_width);
-}
-
-static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
-}
-
-#ifdef CONFIG_GL_WIN32
-
-static int config_w32(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) {
- if (!vo_w32_config(d_width, d_height, flags))
- return -1;
-
- return 0;
-}
-
-#endif
-
-#ifdef CONFIG_GL_X11
-static int choose_glx_visual(Display *dpy, int scr, XVisualInfo *res_vi)
-{
- XVisualInfo template, *vi_list;
- int vi_num, i, best_i, best_weight;
-
- template.screen = scr;
- vi_list = XGetVisualInfo(dpy, VisualScreenMask, &template, &vi_num);
- if (!vi_list) return -1;
- best_weight = 1000000; best_i=0;
- for (i = 0; i < vi_num; i++) {
- int val, res, w = 0;
- /* of course, the visual must support OpenGL rendering... */
- res = glXGetConfig(dpy, vi_list + i, GLX_USE_GL, &val);
- if (res || val == False) continue;
- /* also it must be doublebuffered ... */
- res = glXGetConfig(dpy, vi_list + i, GLX_DOUBLEBUFFER, &val);
- if (res || val == False) continue;
- /* furthermore it must be RGBA (not color indexed) ... */
- res = glXGetConfig(dpy, vi_list + i, GLX_RGBA, &val);
- if (res || val == False) continue;
- /* prefer less depth buffer size, */
- res = glXGetConfig(dpy, vi_list + i, GLX_DEPTH_SIZE, &val);
- if (res) continue;
- w += val*2;
- /* stencil buffer size */
- res = glXGetConfig(dpy, vi_list + i, GLX_STENCIL_SIZE, &val);
- if (res) continue;
- w += val*2;
- /* and colorbuffer alpha size */
- res = glXGetConfig(dpy, vi_list + i, GLX_ALPHA_SIZE, &val);
- if (res) continue;
- w += val;
- /* and finally, prefer DirectColor-ed visuals to allow color corrections */
- if (vi_list[i].class != Dir