Commit aacb8b5f authored by Yann Diorcet's avatar Yann Diorcet
Browse files

reformat and add log in opengles

parent 5ce88630
/*
*
opengles_display.m
Copyright (C) 2011 Belledonne Communications, Grenoble, France
......@@ -22,9 +22,9 @@
#include "shaders.h"
enum ImageType {
REMOTE_IMAGE = 0,
PREVIEW_IMAGE,
MAX_IMAGE
REMOTE_IMAGE = 0,
PREVIEW_IMAGE,
MAX_IMAGE
};
/* helper functions */
......@@ -48,29 +48,29 @@ static bool_t update_textures_with_yuv(struct opengles_display* gldisp, enum Ima
#endif
enum {
UNIFORM_PROJ_MATRIX = 0,
UNIFORM_ROTATION,
UNIFORM_TEXTURE_Y,
UNIFORM_TEXTURE_U,
UNIFORM_TEXTURE_V,
NUM_UNIFORMS
UNIFORM_PROJ_MATRIX = 0,
UNIFORM_ROTATION,
UNIFORM_TEXTURE_Y,
UNIFORM_TEXTURE_U,
UNIFORM_TEXTURE_V,
NUM_UNIFORMS
};
enum {
ATTRIB_VERTEX = 0,
ATTRIB_UV,
NUM_ATTRIBS
ATTRIB_VERTEX = 0,
ATTRIB_UV,
NUM_ATTRIBS
};
enum {
Y,
U,
V
Y,
U,
V
};
#define TEXTURE_BUFFER_SIZE 3
struct opengles_display {
struct opengles_display {
/* input: yuv image to display */
ms_mutex_t yuv_mutex;
mblk_t *yuv[MAX_IMAGE];
......@@ -82,15 +82,15 @@ struct opengles_display {
GLint uniforms[NUM_UNIFORMS];
MSVideoSize allocatedTexturesSize[MAX_IMAGE];
int texture_index;
int texture_index;
/* GL view size */
GLint backingWidth;
GLint backingHeight;
/* runtime data */
float uvx[MAX_IMAGE], uvy[MAX_IMAGE];
MSVideoSize yuv_size[MAX_IMAGE];
MSVideoSize yuv_size[MAX_IMAGE];
/* coordinates of for zoom-in */
float zoom_factor;
......@@ -108,7 +108,7 @@ struct opengles_display* ogl_display_new() {
memset(result, 0, sizeof(struct opengles_display));
result->zoom_factor = 1;
result->zoom_cx = result->zoom_cy = 0;
result->texture_index = 0;
result->texture_index = 0;
ms_mutex_init(&result->yuv_mutex, NULL);
ms_message("%s : %p\n", __FUNCTION__, result);
......@@ -116,37 +116,38 @@ struct opengles_display* ogl_display_new() {
}
void ogl_display_free(struct opengles_display* gldisp) {
int i;
int i;
if (!gldisp) {
ms_error("%s called with null struct opengles_display", __FUNCTION__);
return;
}
for(i=0; i<MAX_IMAGE; i++) {
if (gldisp->yuv[i]) {
ms_free(gldisp->yuv[i]);
gldisp->yuv[i] = NULL;
}
}
for(i=0; i<MAX_IMAGE; i++) {
if (gldisp->yuv[i]) {
ms_free(gldisp->yuv[i]);
gldisp->yuv[i] = NULL;
}
}
ms_mutex_destroy(&gldisp->yuv_mutex);
free(gldisp);
}
void ogl_display_set_size(struct opengles_display* gldisp, int width, int height) {
gldisp->backingWidth = width;
gldisp->backingWidth = width;
gldisp->backingHeight = height;
GL_OPERATION(glViewport(0, 0, gldisp->backingWidth, gldisp->backingHeight));
check_GL_errors("ogl_display_set_size");
ms_message("resize opengles_display (%d x %d, gl initialized:%d)", width, height, gldisp->glResourcesInitialized);
GL_OPERATION(glViewport(0, 0, gldisp->backingWidth, gldisp->backingHeight));
check_GL_errors("ogl_display_set_size");
}
void ogl_display_init(struct opengles_display* gldisp, int width, int height) {
int i,j;
static bool_t version_displayed = FALSE;
if (!gldisp) {
if (!gldisp) {
ms_error("%s called with null struct opengles_display", __FUNCTION__);
return;
}
......@@ -154,20 +155,20 @@ void ogl_display_init(struct opengles_display* gldisp, int width, int height) {
ms_message("init opengles_display (%d x %d, gl initialized:%d)", width, height, gldisp->glResourcesInitialized);
GL_OPERATION(glDisable(GL_DEPTH_TEST))
GL_OPERATION(glClearColor(0, 0, 0, 1))
GL_OPERATION(glClearColor(0, 0, 0, 1))
ogl_display_set_size(gldisp, width, height);
ogl_display_set_size(gldisp, width, height);
if (gldisp->glResourcesInitialized)
return;
for(j=0; j<TEXTURE_BUFFER_SIZE; j++) {
// init textures
for(i=0; i<MAX_IMAGE; i++) {
GL_OPERATION(glGenTextures(3, gldisp->textures[j][i]))
gldisp->allocatedTexturesSize[i].width = gldisp->allocatedTexturesSize[i].height = 0;
}
}
for(j=0; j<TEXTURE_BUFFER_SIZE; j++) {
// init textures
for(i=0; i<MAX_IMAGE; i++) {
GL_OPERATION(glGenTextures(3, gldisp->textures[j][i]))
gldisp->allocatedTexturesSize[i].width = gldisp->allocatedTexturesSize[i].height = 0;
}
}
if (!version_displayed) {
version_displayed = TRUE;
......@@ -179,43 +180,43 @@ void ogl_display_init(struct opengles_display* gldisp, int width, int height) {
ms_message("OpenGL GLSL version: %s", glGetString(GL_SHADING_LANGUAGE_VERSION));
}
load_shaders(&gldisp->program, gldisp->uniforms);
GL_OPERATION(glUseProgram(gldisp->program))
GL_OPERATION(glUseProgram(gldisp->program))
gldisp->glResourcesInitialized = TRUE;
check_GL_errors("ogl_display_init");
check_GL_errors("ogl_display_init");
}
void ogl_display_uninit(struct opengles_display* gldisp, bool_t freeGLresources) {
int i,j;
if (!gldisp) {
int i,j;
if (!gldisp) {
ms_error("%s called with null struct opengles_display", __FUNCTION__);
return;
}
ms_message("uninit opengles_display (gl initialized:%d)\n", gldisp->glResourcesInitialized);
for(i=0; i<MAX_IMAGE; i++) {
if (gldisp->yuv[i]) {
ms_free(gldisp->yuv[i]);
gldisp->yuv[i] = NULL;
}
}
for(i=0; i<MAX_IMAGE; i++) {
if (gldisp->yuv[i]) {
ms_free(gldisp->yuv[i]);
gldisp->yuv[i] = NULL;
}
}
if (gldisp->glResourcesInitialized && freeGLresources) {
// destroy gl resources
for(j=0; j<TEXTURE_BUFFER_SIZE; j++) {
for(i=0; i<MAX_IMAGE; i++) {
GL_OPERATION(glDeleteTextures(3, gldisp->textures[j][i]));
gldisp->allocatedTexturesSize[i].width = gldisp->allocatedTexturesSize[i].height = 0;
}
}
// destroy gl resources
for(j=0; j<TEXTURE_BUFFER_SIZE; j++) {
for(i=0; i<MAX_IMAGE; i++) {
GL_OPERATION(glDeleteTextures(3, gldisp->textures[j][i]));
gldisp->allocatedTexturesSize[i].width = gldisp->allocatedTexturesSize[i].height = 0;
}
}
GL_OPERATION(glDeleteProgram(gldisp->program));
}
gldisp->glResourcesInitialized = FALSE;
check_GL_errors("ogl_display_uninit");
check_GL_errors("ogl_display_uninit");
}
static void ogl_display_set_yuv(struct opengles_display* gldisp, mblk_t *yuv, enum ImageType type) {
......@@ -227,12 +228,12 @@ static void ogl_display_set_yuv(struct opengles_display* gldisp, mblk_t *yuv, en
if (gldisp->yuv[type])
freemsg(gldisp->yuv[type]);
gldisp->yuv[type] = dupmsg(yuv);
int j;
for(j = 0; j < TEXTURE_BUFFER_SIZE; ++j) {
gldisp->new_yuv_image[j][type] = TRUE;
}
ms_mutex_unlock(&gldisp->yuv_mutex);
int j;
for(j = 0; j < TEXTURE_BUFFER_SIZE; ++j) {
gldisp->new_yuv_image[j][type] = TRUE;
}
ms_mutex_unlock(&gldisp->yuv_mutex);
}
void ogl_display_set_yuv_to_display(struct opengles_display* gldisp, mblk_t *yuv) {
......@@ -251,14 +252,14 @@ static void ogl_display_render_type(struct opengles_display* gldisp, enum ImageT
if (!gldisp->yuv[type] || !gldisp->glResourcesInitialized) {
return;
}
ms_mutex_lock(&gldisp->yuv_mutex);
if (gldisp->new_yuv_image[gldisp->texture_index][type]) {
update_textures_with_yuv(gldisp, type);
update_textures_with_yuv(gldisp, type);
gldisp->new_yuv_image[gldisp->texture_index][type] = FALSE;
}
ms_mutex_unlock(&gldisp->yuv_mutex);
float uLeft, uRight, vTop, vBottom;
uLeft = vBottom = 0.0f;
......@@ -270,27 +271,27 @@ static void ogl_display_render_type(struct opengles_display* gldisp, enum ImageT
uRight, vTop,
uLeft, vBottom,
uRight, vBottom
};
if (clear) {
GL_OPERATION(glClear(GL_COLOR_BUFFER_BIT))
}
GLfloat squareVertices[8];
};
if (clear) {
GL_OPERATION(glClear(GL_COLOR_BUFFER_BIT))
}
GLfloat squareVertices[8];
// drawing surface dimensions
int screenW = gldisp->backingWidth;
int screenH = gldisp->backingHeight;
int screenH = gldisp->backingHeight;
if (orientation == 90 || orientation == 270) {
screenW = screenH;
screenH = gldisp->backingWidth;
screenH = gldisp->backingWidth;
}
int x,y,w,h;
// Fill the smallest dimension, then compute the other one using the image ratio
if (screenW <= screenH) {
float ratio = (gldisp->yuv_size[type].height) / (float)(gldisp->yuv_size[type].width);
w = screenW * vpw;
w = screenW * vpw;
h = w * ratio;
if (h > screenH) {
w *= screenH /(float) h;
......@@ -300,7 +301,7 @@ static void ogl_display_render_type(struct opengles_display* gldisp, enum ImageT
y = vpy * gldisp->backingHeight;
} else {
float ratio = gldisp->yuv_size[type].width / (float)gldisp->yuv_size[type].height;
h = screenH * vph;
h = screenH * vph;
w = h * ratio;
if (w > screenW) {
h *= screenW / (float)w;
......@@ -309,36 +310,36 @@ static void ogl_display_render_type(struct opengles_display* gldisp, enum ImageT
x = vpx * screenW;
y = vpy * screenH;
}
squareVertices[0] = (x - w * 0.5) / screenW - 0.;
squareVertices[1] = (y - h * 0.5) / screenH - 0.;
squareVertices[2] = (x + w * 0.5) / screenW - 0.;
squareVertices[3] = (y - h * 0.5) / screenH - 0.;
squareVertices[4] = (x - w * 0.5) / screenW - 0.;
squareVertices[5] = (y + h * 0.5) / screenH - 0.;
squareVertices[6] = (x + w * 0.5) / screenW - 0.;
squareVertices[7] = (y + h * 0.5) / screenH - 0.;
squareVertices[0] = (x - w * 0.5) / screenW - 0.;
squareVertices[1] = (y - h * 0.5) / screenH - 0.;
squareVertices[2] = (x + w * 0.5) / screenW - 0.;
squareVertices[3] = (y - h * 0.5) / screenH - 0.;
squareVertices[4] = (x - w * 0.5) / screenW - 0.;
squareVertices[5] = (y + h * 0.5) / screenH - 0.;
squareVertices[6] = (x + w * 0.5) / screenW - 0.;
squareVertices[7] = (y + h * 0.5) / screenH - 0.;
GLfloat mat[16];
#define VP_SIZE 1.0f
if (type == REMOTE_IMAGE) {
float scale_factor = 1.0 / gldisp->zoom_factor;
float vpDim = (VP_SIZE * scale_factor) / 2;
#define ENSURE_RANGE_A_INSIDE_RANGE_B(a, aSize, bMin, bMax) \
if (2*aSize >= (bMax - bMin)) \
a = 0; \
else if ((a - aSize < bMin) || (a + aSize > bMax)) { \
float diff; \
if (a - aSize < bMin) diff = bMin - (a - aSize); \
else diff = bMax - (a + aSize); \
a += diff; \
}
ENSURE_RANGE_A_INSIDE_RANGE_B(gldisp->zoom_cx, vpDim, squareVertices[0], squareVertices[2])
ENSURE_RANGE_A_INSIDE_RANGE_B(gldisp->zoom_cy, vpDim, squareVertices[1], squareVertices[7])
load_orthographic_matrix(
#define ENSURE_RANGE_A_INSIDE_RANGE_B(a, aSize, bMin, bMax) \
if (2*aSize >= (bMax - bMin)) \
a = 0; \
else if ((a - aSize < bMin) || (a + aSize > bMax)) { \
float diff; \
if (a - aSize < bMin) diff = bMin - (a - aSize); \
else diff = bMax - (a + aSize); \
a += diff; \
}
ENSURE_RANGE_A_INSIDE_RANGE_B(gldisp->zoom_cx, vpDim, squareVertices[0], squareVertices[2])
ENSURE_RANGE_A_INSIDE_RANGE_B(gldisp->zoom_cy, vpDim, squareVertices[1], squareVertices[7])
load_orthographic_matrix(
gldisp->zoom_cx - vpDim,
gldisp->zoom_cx + vpDim,
gldisp->zoom_cy - vpDim,
......@@ -349,57 +350,57 @@ static void ogl_display_render_type(struct opengles_display* gldisp, enum ImageT
}
GL_OPERATION(glUniformMatrix4fv(gldisp->uniforms[UNIFORM_PROJ_MATRIX], 1, GL_FALSE, mat))
float rad = (2.0 * 3.14157 * orientation / 360.0); // Convert orientation to radian
GL_OPERATION(glUniform1f(gldisp->uniforms[UNIFORM_ROTATION], rad))
GL_OPERATION(glActiveTexture(GL_TEXTURE0))
float rad = (2.0 * 3.14157 * orientation / 360.0); // Convert orientation to radian
GL_OPERATION(glUniform1f(gldisp->uniforms[UNIFORM_ROTATION], rad))
GL_OPERATION(glActiveTexture(GL_TEXTURE0))
GL_OPERATION(glBindTexture(GL_TEXTURE_2D, gldisp->textures[gldisp->texture_index][type][Y]))
GL_OPERATION(glUniform1i(gldisp->uniforms[UNIFORM_TEXTURE_Y], 0))
GL_OPERATION(glActiveTexture(GL_TEXTURE1))
GL_OPERATION(glActiveTexture(GL_TEXTURE1))
GL_OPERATION(glBindTexture(GL_TEXTURE_2D, gldisp->textures[gldisp->texture_index][type][U]))
GL_OPERATION(glUniform1i(gldisp->uniforms[UNIFORM_TEXTURE_U], 1))
GL_OPERATION(glActiveTexture(GL_TEXTURE2))
GL_OPERATION(glActiveTexture(GL_TEXTURE2))
GL_OPERATION(glBindTexture(GL_TEXTURE_2D, gldisp->textures[gldisp->texture_index][type][V]))
GL_OPERATION(glUniform1i(gldisp->uniforms[UNIFORM_TEXTURE_V], 2))
GL_OPERATION(glVertexAttribPointer(ATTRIB_VERTEX, 2, GL_FLOAT, 0, 0, squareVertices))
GL_OPERATION(glEnableVertexAttribArray(ATTRIB_VERTEX))
GL_OPERATION(glVertexAttribPointer(ATTRIB_UV, 2, GL_FLOAT, 1, 0, squareUvs))
GL_OPERATION(glEnableVertexAttribArray(ATTRIB_UV))
GL_OPERATION(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4))
check_GL_errors("ogl_display_render_type");
check_GL_errors("ogl_display_render_type");
}
void ogl_display_render(struct opengles_display* gldisp, int orientation) {
ogl_display_render_type(gldisp, REMOTE_IMAGE, TRUE, 0, 0, 1, 1, orientation);
// preview image already have the correct orientation
ogl_display_render_type(gldisp, PREVIEW_IMAGE, FALSE, 0.4f, -0.4f, 0.2f, 0.2f, 0);
gldisp->texture_index = (gldisp->texture_index + 1) % TEXTURE_BUFFER_SIZE;
ogl_display_render_type(gldisp, REMOTE_IMAGE, TRUE, 0, 0, 1, 1, orientation);
// preview image already have the correct orientation
ogl_display_render_type(gldisp, PREVIEW_IMAGE, FALSE, 0.4f, -0.4f, 0.2f, 0.2f, 0);
gldisp->texture_index = (gldisp->texture_index + 1) % TEXTURE_BUFFER_SIZE;
}
static void check_GL_errors(const char* context) {
int maxIterations=10;
GLenum error;
while (((error = glGetError()) != GL_NO_ERROR) && maxIterations > 0)
{
switch(error)
{
case GL_INVALID_ENUM: ms_error("[%2d]GL error: '%s' -> GL_INVALID_ENUM\n", maxIterations, context); break;
case GL_INVALID_VALUE: ms_error("[%2d]GL error: '%s' -> GL_INVALID_VALUE\n", maxIterations, context); break;
case GL_INVALID_OPERATION: ms_error("[%2d]GL error: '%s' -> GL_INVALID_OPERATION\n", maxIterations, context); break;
case GL_OUT_OF_MEMORY: ms_error("[%2d]GL error: '%s' -> GL_OUT_OF_MEMORY\n", maxIterations, context); break;
case GL_INVALID_FRAMEBUFFER_OPERATION: ms_error("[%2d]GL error: '%s' -> GL_INVALID_FRAMEBUFFER_OPERATION\n", maxIterations, context); break;
default:
ms_error("[%2d]GL error: '%s' -> %x\n", maxIterations, context, error);
}
GLenum error;
while (((error = glGetError()) != GL_NO_ERROR) && maxIterations > 0)
{
switch(error)
{
case GL_INVALID_ENUM: ms_error("[%2d]GL error: '%s' -> GL_INVALID_ENUM\n", maxIterations, context); break;
case GL_INVALID_VALUE: ms_error("[%2d]GL error: '%s' -> GL_INVALID_VALUE\n", maxIterations, context); break;
case GL_INVALID_OPERATION: ms_error("[%2d]GL error: '%s' -> GL_INVALID_OPERATION\n", maxIterations, context); break;
case GL_OUT_OF_MEMORY: ms_error("[%2d]GL error: '%s' -> GL_OUT_OF_MEMORY\n", maxIterations, context); break;
case GL_INVALID_FRAMEBUFFER_OPERATION: ms_error("[%2d]GL error: '%s' -> GL_INVALID_FRAMEBUFFER_OPERATION\n", maxIterations, context); break;
default:
ms_error("[%2d]GL error: '%s' -> %x\n", maxIterations, context, error);
}
maxIterations--;
}
}
}
static bool_t load_shaders(GLuint* program, GLint* uniforms) {
......@@ -408,66 +409,66 @@ static bool_t load_shaders(GLuint* program, GLint* uniforms) {
yuv2rgb_fs_len = yuv2rgb_fs_len;
yuv2rgb_vs_len = yuv2rgb_vs_len;
GLuint vertShader, fragShader;
*program = glCreateProgram();
GLuint vertShader, fragShader;
*program = glCreateProgram();
if (!compileShader(&vertShader, GL_VERTEX_SHADER, (const char*)yuv2rgb_vs))
return FALSE;
if (!compileShader(&fragShader, GL_FRAGMENT_SHADER, (const char*)yuv2rgb_fs))
return FALSE;
if (!compileShader(&vertShader, GL_VERTEX_SHADER, (const char*)yuv2rgb_vs))
return FALSE;
if (!compileShader(&fragShader, GL_FRAGMENT_SHADER, (const char*)yuv2rgb_fs))
return FALSE;
GL_OPERATION(glAttachShader(*program, vertShader))
GL_OPERATION(glAttachShader(*program, fragShader))
GL_OPERATION(glAttachShader(*program, vertShader))
GL_OPERATION(glAttachShader(*program, fragShader))
GL_OPERATION(glBindAttribLocation(*program, ATTRIB_VERTEX, "position"))
GL_OPERATION(glBindAttribLocation(*program, ATTRIB_UV, "uv"))
GL_OPERATION(glBindAttribLocation(*program, ATTRIB_VERTEX, "position"))
GL_OPERATION(glBindAttribLocation(*program, ATTRIB_UV, "uv"))
if (!linkProgram(*program))
return FALSE;
if (!linkProgram(*program))
return FALSE;
uniforms[UNIFORM_PROJ_MATRIX] = glGetUniformLocation(*program, "proj_matrix");
uniforms[UNIFORM_ROTATION] = glGetUniformLocation(*program, "rotation");
uniforms[UNIFORM_TEXTURE_Y] = glGetUniformLocation(*program, "t_texture_y");
uniforms[UNIFORM_TEXTURE_U] = glGetUniformLocation(*program, "t_texture_u");
uniforms[UNIFORM_TEXTURE_V] = glGetUniformLocation(*program, "t_texture_v");
uniforms[UNIFORM_PROJ_MATRIX] = glGetUniformLocation(*program, "proj_matrix");
uniforms[UNIFORM_ROTATION] = glGetUniformLocation(*program, "rotation");
uniforms[UNIFORM_TEXTURE_Y] = glGetUniformLocation(*program, "t_texture_y");
uniforms[UNIFORM_TEXTURE_U] = glGetUniformLocation(*program, "t_texture_u");
uniforms[UNIFORM_TEXTURE_V] = glGetUniformLocation(*program, "t_texture_v");
glDeleteShader(vertShader);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteShader(fragShader);
return TRUE;
check_GL_errors("load_shaders");
return TRUE;
check_GL_errors("load_shaders");
}
static void load_orthographic_matrix(float left, float right, float bottom, float top, float near, float far, float* mat)
{
float r_l = right - left;
float t_b = top - bottom;
float f_n = far - near;
float tx = - (right + left) / (right - left);
float ty = - (top + bottom) / (top - bottom);
float tz = - (far + near) / (far - near);
mat[0] = (2.0f / r_l);
mat[1] = mat[2] = mat[3] = 0.0f;
mat[4] = 0.0f;
mat[5] = (2.0f / t_b);
mat[6] = mat[7] = 0.0f;
mat[8] = mat[9] = 0.0f;
mat[10] = -2.0f / f_n;
mat[11] = 0.0f;
mat[12] = tx;
mat[13] = ty;
mat[14] = tz;
mat[15] = 1.0f;
float r_l = right - left;
float t_b = top - bottom;
float f_n = far - near;
float tx = - (right + left) / (right - left);
float ty = - (top + bottom) / (top - bottom);
float tz = - (far + near) / (far - near);
mat[0] = (2.0f / r_l);
mat[1] = mat[2] = mat[3] = 0.0f;
mat[4] = 0.0f;
mat[5] = (2.0f / t_b);
mat[6] = mat[7] = 0.0f;
mat[8] = mat[9] = 0.0f;
mat[10] = -2.0f / f_n;
mat[11] = 0.0f;
mat[12] = tx;
mat[13] = ty;
mat[14] = tz;
mat[15] = 1.0f;
}
static void allocate_gl_textures(struct opengles_display* gldisp, int w, int h, enum ImageType type) {
int j;
for(j=0; j<TEXTURE_BUFFER_SIZE; j++) {
int j;
for(j=0; j<TEXTURE_BUFFER_SIZE; j++) {
GL_OPERATION(glActiveTexture(GL_TEXTURE0))
GL_OPERATION(glBindTexture(GL_TEXTURE_2D, gldisp->textures[j][type][Y]))
GL_OPERATION(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR))
......@@ -492,13 +493,13 @@ static void allocate_gl_textures(struct opengles_display* gldisp, int w, int h,
GL_OPERATION(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE))
GL_OPERATION(glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, w >> 1, h >> 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, 0))
}
}
gldisp->allocatedTexturesSize[type].width = w;
gldisp->allocatedTexturesSize[type].height = h;
ms_message("%s: allocated new textures[%d] (%d x %d)\n", __FUNCTION__, type, w, h);
check_GL_errors("allocate_gl_textures");
check_GL_errors("allocate_gl_textures");
}
static unsigned int align_on_power_of_2(unsigned int value) {
......@@ -560,8 +561,8 @@ static bool_t update_textures_with_yuv(struct opengles_display* gldisp, enum Ima
gldisp->yuv_size[type].width = yuvbuf.w;
gldisp->yuv_size[type].height = yuvbuf.h;