[vlc-devel] [PATCH 1/2] OpenGL: put in a new file the geometry building functions to reduce a bit the size of vout_helper.c

Adrien Maglo magsoft at videolan.org
Mon Jul 31 16:30:19 CEST 2017


---
 modules/video_output/Makefile.am          |   3 +-
 modules/video_output/opengl/geometry.c    | 296 ++++++++++++++++++++++++++++++
 modules/video_output/opengl/geometry.h    |  49 +++++
 modules/video_output/opengl/vout_helper.c | 271 +--------------------------
 4 files changed, 348 insertions(+), 271 deletions(-)
 create mode 100644 modules/video_output/opengl/geometry.c
 create mode 100644 modules/video_output/opengl/geometry.h

diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index 094a7f5025..274b79968c 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -8,7 +8,8 @@ OPENGL_COMMONLDFLAGS =
 OPENGL_COMMONLIBS =
 OPENGL_COMMONSOURCES = video_output/opengl/vout_helper.c \
 	video_output/opengl/vout_helper.h video_output/opengl/internal.h \
-	video_output/opengl/converters.c
+	video_output/opengl/converters.c video_output/opengl/geometry.h \
+	video_output/opengl/geometry.c
 if HAVE_ANDROID
 OPENGL_COMMONSOURCES += video_output/opengl/converter_android.c
 endif
diff --git a/modules/video_output/opengl/geometry.c b/modules/video_output/opengl/geometry.c
new file mode 100644
index 0000000000..09966a9ec9
--- /dev/null
+++ b/modules/video_output/opengl/geometry.c
@@ -0,0 +1,296 @@
+/*****************************************************************************
+ * geometry.c: OpenGL geometry builder
+ *****************************************************************************
+ * Copyright (C) 2016 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <math.h>
+
+#include "geometry.h"
+
+
+int BuildSphere(unsigned nbPlanes,
+                GLfloat **vertexCoord, GLfloat **textureCoord, unsigned *nbVertices,
+                GLushort **indices, unsigned *nbIndices,
+                const float *left, const float *top,
+                const float *right, const float *bottom)
+{
+    unsigned nbLatBands = 128;
+    unsigned nbLonBands = 128;
+
+    *nbVertices = (nbLatBands + 1) * (nbLonBands + 1);
+    *nbIndices = nbLatBands * nbLonBands * 3 * 2;
+
+    *vertexCoord = malloc(*nbVertices * 3 * sizeof(GLfloat));
+    if (*vertexCoord == NULL)
+        return VLC_ENOMEM;
+    *textureCoord = malloc(nbPlanes * *nbVertices * 2 * sizeof(GLfloat));
+    if (*textureCoord == NULL)
+    {
+        free(*vertexCoord);
+        return VLC_ENOMEM;
+    }
+    *indices = malloc(*nbIndices * sizeof(GLushort));
+    if (*indices == NULL)
+    {
+        free(*textureCoord);
+        free(*vertexCoord);
+        return VLC_ENOMEM;
+    }
+
+    for (unsigned lat = 0; lat <= nbLatBands; lat++) {
+        float theta = lat * (float) M_PI / nbLatBands;
+        float sinTheta, cosTheta;
+
+        sincosf(theta, &sinTheta, &cosTheta);
+
+        for (unsigned lon = 0; lon <= nbLonBands; lon++) {
+            float phi = lon * 2 * (float) M_PI / nbLonBands;
+            float sinPhi, cosPhi;
+
+            sincosf(phi, &sinPhi, &cosPhi);
+
+            float x = cosPhi * sinTheta;
+            float y = cosTheta;
+            float z = sinPhi * sinTheta;
+
+            unsigned off1 = (lat * (nbLonBands + 1) + lon) * 3;
+            (*vertexCoord)[off1] = SPHERE_RADIUS * x;
+            (*vertexCoord)[off1 + 1] = SPHERE_RADIUS * y;
+            (*vertexCoord)[off1 + 2] = SPHERE_RADIUS * z;
+
+            for (unsigned p = 0; p < nbPlanes; ++p)
+            {
+                unsigned off2 = (p * (nbLatBands + 1) * (nbLonBands + 1)
+                                + lat * (nbLonBands + 1) + lon) * 2;
+                float width = right[p] - left[p];
+                float height = bottom[p] - top[p];
+                float u = (float)lon / nbLonBands * width;
+                float v = (float)lat / nbLatBands * height;
+                (*textureCoord)[off2] = u;
+                (*textureCoord)[off2 + 1] = v;
+            }
+        }
+    }
+
+    for (unsigned lat = 0; lat < nbLatBands; lat++) {
+        for (unsigned lon = 0; lon < nbLonBands; lon++) {
+            unsigned first = (lat * (nbLonBands + 1)) + lon;
+            unsigned second = first + nbLonBands + 1;
+
+            unsigned off = (lat * nbLatBands + lon) * 3 * 2;
+
+            (*indices)[off] = first;
+            (*indices)[off + 1] = second;
+            (*indices)[off + 2] = first + 1;
+
+            (*indices)[off + 3] = second;
+            (*indices)[off + 4] = second + 1;
+            (*indices)[off + 5] = first + 1;
+        }
+    }
+
+    return VLC_SUCCESS;
+}
+
+
+int BuildCube(unsigned nbPlanes,
+              float padW, float padH,
+              GLfloat **vertexCoord, GLfloat **textureCoord, unsigned *nbVertices,
+              GLushort **indices, unsigned *nbIndices,
+              const float *left, const float *top,
+              const float *right, const float *bottom)
+{
+    *nbVertices = 4 * 6;
+    *nbIndices = 6 * 6;
+
+    *vertexCoord = malloc(*nbVertices * 3 * sizeof(GLfloat));
+    if (*vertexCoord == NULL)
+        return VLC_ENOMEM;
+    *textureCoord = malloc(nbPlanes * *nbVertices * 2 * sizeof(GLfloat));
+    if (*textureCoord == NULL)
+    {
+        free(*vertexCoord);
+        return VLC_ENOMEM;
+    }
+    *indices = malloc(*nbIndices * sizeof(GLushort));
+    if (*indices == NULL)
+    {
+        free(*textureCoord);
+        free(*vertexCoord);
+        return VLC_ENOMEM;
+    }
+
+    static const GLfloat coord[] = {
+        -1.0,    1.0,    -1.0f, // front
+        -1.0,    -1.0,   -1.0f,
+        1.0,     1.0,    -1.0f,
+        1.0,     -1.0,   -1.0f,
+
+        -1.0,    1.0,    1.0f, // back
+        -1.0,    -1.0,   1.0f,
+        1.0,     1.0,    1.0f,
+        1.0,     -1.0,   1.0f,
+
+        -1.0,    1.0,    -1.0f, // left
+        -1.0,    -1.0,   -1.0f,
+        -1.0,     1.0,    1.0f,
+        -1.0,     -1.0,   1.0f,
+
+        1.0f,    1.0,    -1.0f, // right
+        1.0f,   -1.0,    -1.0f,
+        1.0f,   1.0,     1.0f,
+        1.0f,   -1.0,    1.0f,
+
+        -1.0,    -1.0,    1.0f, // bottom
+        -1.0,    -1.0,   -1.0f,
+        1.0,     -1.0,    1.0f,
+        1.0,     -1.0,   -1.0f,
+
+        -1.0,    1.0,    1.0f, // top
+        -1.0,    1.0,   -1.0f,
+        1.0,     1.0,    1.0f,
+        1.0,     1.0,   -1.0f,
+    };
+
+    memcpy(*vertexCoord, coord, *nbVertices * 3 * sizeof(GLfloat));
+
+    for (unsigned p = 0; p < nbPlanes; ++p)
+    {
+        float width = right[p] - left[p];
+        float height = bottom[p] - top[p];
+
+        float col[] = {left[p],
+                       left[p] + width * 1.f/3,
+                       left[p] + width * 2.f/3,
+                       left[p] + width};
+
+        float row[] = {top[p],
+                       top[p] + height * 1.f/2,
+                       top[p] + height};
+
+        const GLfloat tex[] = {
+            col[1] + padW, row[1] + padH, // front
+            col[1] + padW, row[2] - padH,
+            col[2] - padW, row[1] + padH,
+            col[2] - padW, row[2] - padH,
+
+            col[3] - padW, row[1] + padH, // back
+            col[3] - padW, row[2] - padH,
+            col[2] + padW, row[1] + padH,
+            col[2] + padW, row[2] - padH,
+
+            col[2] - padW, row[0] + padH, // left
+            col[2] - padW, row[1] - padH,
+            col[1] + padW, row[0] + padH,
+            col[1] + padW, row[1] - padH,
+
+            col[0] + padW, row[0] + padH, // right
+            col[0] + padW, row[1] - padH,
+            col[1] - padW, row[0] + padH,
+            col[1] - padW, row[1] - padH,
+
+            col[0] + padW, row[2] - padH, // bottom
+            col[0] + padW, row[1] + padH,
+            col[1] - padW, row[2] - padH,
+            col[1] - padW, row[1] + padH,
+
+            col[2] + padW, row[0] + padH, // top
+            col[2] + padW, row[1] - padH,
+            col[3] - padW, row[0] + padH,
+            col[3] - padW, row[1] - padH,
+        };
+
+        memcpy(*textureCoord + p * *nbVertices * 2, tex,
+               *nbVertices * 2 * sizeof(GLfloat));
+    }
+
+    const GLushort ind[] = {
+        0, 1, 2,       2, 1, 3, // front
+        6, 7, 4,       4, 7, 5, // back
+        10, 11, 8,     8, 11, 9, // left
+        12, 13, 14,    14, 13, 15, // right
+        18, 19, 16,    16, 19, 17, // bottom
+        20, 21, 22,    22, 21, 23, // top
+    };
+
+    memcpy(*indices, ind, *nbIndices * sizeof(GLushort));
+
+    return VLC_SUCCESS;
+}
+
+
+int BuildRectangle(unsigned nbPlanes,
+                   GLfloat **vertexCoord, GLfloat **textureCoord, unsigned *nbVertices,
+                   GLushort **indices, unsigned *nbIndices,
+                   const float *left, const float *top,
+                   const float *right, const float *bottom)
+{
+    *nbVertices = 4;
+    *nbIndices = 6;
+
+    *vertexCoord = malloc(*nbVertices * 3 * sizeof(GLfloat));
+    if (*vertexCoord == NULL)
+        return VLC_ENOMEM;
+    *textureCoord = malloc(nbPlanes * *nbVertices * 2 * sizeof(GLfloat));
+    if (*textureCoord == NULL)
+    {
+        free(*vertexCoord);
+        return VLC_ENOMEM;
+    }
+    *indices = malloc(*nbIndices * sizeof(GLushort));
+    if (*indices == NULL)
+    {
+        free(*textureCoord);
+        free(*vertexCoord);
+        return VLC_ENOMEM;
+    }
+
+    static const GLfloat coord[] = {
+       -1.0,    1.0,    -1.0f,
+       -1.0,    -1.0,   -1.0f,
+       1.0,     1.0,    -1.0f,
+       1.0,     -1.0,   -1.0f
+    };
+
+    memcpy(*vertexCoord, coord, *nbVertices * 3 * sizeof(GLfloat));
+
+    for (unsigned p = 0; p < nbPlanes; ++p)
+    {
+        const GLfloat tex[] = {
+            left[p],  top[p],
+            left[p],  bottom[p],
+            right[p], top[p],
+            right[p], bottom[p]
+        };
+
+        memcpy(*textureCoord + p * *nbVertices * 2, tex,
+               *nbVertices * 2 * sizeof(GLfloat));
+    }
+
+    const GLushort ind[] = {
+        0, 1, 2,
+        2, 1, 3
+    };
+
+    memcpy(*indices, ind, *nbIndices * sizeof(GLushort));
+
+    return VLC_SUCCESS;
+}
diff --git a/modules/video_output/opengl/geometry.h b/modules/video_output/opengl/geometry.h
new file mode 100644
index 0000000000..a7f5d6b4f5
--- /dev/null
+++ b/modules/video_output/opengl/geometry.h
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * geometry.h: OpenGL geometry builder header
+ *****************************************************************************
+ * Copyright (C) 2016 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef VLC_OPENGL_GEOMETRY_H
+#define VLC_OPENGL_GEOMETRY_H
+
+#include "vout_helper.h"
+
+#define SPHERE_RADIUS 1.f
+
+
+int BuildSphere(unsigned nbPlanes,
+                GLfloat **vertexCoord, GLfloat **textureCoord, unsigned *nbVertices,
+                GLushort **indices, unsigned *nbIndices,
+                const float *left, const float *top,
+                const float *right, const float *bottom);
+
+int BuildCube(unsigned nbPlanes,
+              float padW, float padH,
+              GLfloat **vertexCoord, GLfloat **textureCoord, unsigned *nbVertices,
+              GLushort **indices, unsigned *nbIndices,
+              const float *left, const float *top,
+              const float *right, const float *bottom);
+
+int BuildRectangle(unsigned nbPlanes,
+                   GLfloat **vertexCoord, GLfloat **textureCoord, unsigned *nbVertices,
+                   GLushort **indices, unsigned *nbIndices,
+                   const float *left, const float *top,
+                   const float *right, const float *bottom);
+
+
+#endif // VLC_OPENGL_GEOMETRY_H
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index 5c35ade2c1..a46d8dee12 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -42,13 +42,12 @@
 
 #include "vout_helper.h"
 #include "internal.h"
+#include "geometry.h"
 
 #ifndef GL_CLAMP_TO_EDGE
 # define GL_CLAMP_TO_EDGE 0x812F
 #endif
 
-#define SPHERE_RADIUS 1.f
-
 static opengl_tex_converter_init_cb opengl_tex_converter_init_cbs[] =
 {
 #ifdef VLCGL_CONV_VA
@@ -1078,274 +1077,6 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
     return ret;
 }
 
-static int BuildSphere(unsigned nbPlanes,
-                        GLfloat **vertexCoord, GLfloat **textureCoord, unsigned *nbVertices,
-                        GLushort **indices, unsigned *nbIndices,
-                        const float *left, const float *top,
-                        const float *right, const float *bottom)
-{
-    unsigned nbLatBands = 128;
-    unsigned nbLonBands = 128;
-
-    *nbVertices = (nbLatBands + 1) * (nbLonBands + 1);
-    *nbIndices = nbLatBands * nbLonBands * 3 * 2;
-
-    *vertexCoord = malloc(*nbVertices * 3 * sizeof(GLfloat));
-    if (*vertexCoord == NULL)
-        return VLC_ENOMEM;
-    *textureCoord = malloc(nbPlanes * *nbVertices * 2 * sizeof(GLfloat));
-    if (*textureCoord == NULL)
-    {
-        free(*vertexCoord);
-        return VLC_ENOMEM;
-    }
-    *indices = malloc(*nbIndices * sizeof(GLushort));
-    if (*indices == NULL)
-    {
-        free(*textureCoord);
-        free(*vertexCoord);
-        return VLC_ENOMEM;
-    }
-
-    for (unsigned lat = 0; lat <= nbLatBands; lat++) {
-        float theta = lat * (float) M_PI / nbLatBands;
-        float sinTheta, cosTheta;
-
-        sincosf(theta, &sinTheta, &cosTheta);
-
-        for (unsigned lon = 0; lon <= nbLonBands; lon++) {
-            float phi = lon * 2 * (float) M_PI / nbLonBands;
-            float sinPhi, cosPhi;
-
-            sincosf(phi, &sinPhi, &cosPhi);
-
-            float x = cosPhi * sinTheta;
-            float y = cosTheta;
-            float z = sinPhi * sinTheta;
-
-            unsigned off1 = (lat * (nbLonBands + 1) + lon) * 3;
-            (*vertexCoord)[off1] = SPHERE_RADIUS * x;
-            (*vertexCoord)[off1 + 1] = SPHERE_RADIUS * y;
-            (*vertexCoord)[off1 + 2] = SPHERE_RADIUS * z;
-
-            for (unsigned p = 0; p < nbPlanes; ++p)
-            {
-                unsigned off2 = (p * (nbLatBands + 1) * (nbLonBands + 1)
-                                + lat * (nbLonBands + 1) + lon) * 2;
-                float width = right[p] - left[p];
-                float height = bottom[p] - top[p];
-                float u = (float)lon / nbLonBands * width;
-                float v = (float)lat / nbLatBands * height;
-                (*textureCoord)[off2] = u;
-                (*textureCoord)[off2 + 1] = v;
-            }
-        }
-    }
-
-    for (unsigned lat = 0; lat < nbLatBands; lat++) {
-        for (unsigned lon = 0; lon < nbLonBands; lon++) {
-            unsigned first = (lat * (nbLonBands + 1)) + lon;
-            unsigned second = first + nbLonBands + 1;
-
-            unsigned off = (lat * nbLatBands + lon) * 3 * 2;
-
-            (*indices)[off] = first;
-            (*indices)[off + 1] = second;
-            (*indices)[off + 2] = first + 1;
-
-            (*indices)[off + 3] = second;
-            (*indices)[off + 4] = second + 1;
-            (*indices)[off + 5] = first + 1;
-        }
-    }
-
-    return VLC_SUCCESS;
-}
-
-
-static int BuildCube(unsigned nbPlanes,
-                     float padW, float padH,
-                     GLfloat **vertexCoord, GLfloat **textureCoord, unsigned *nbVertices,
-                     GLushort **indices, unsigned *nbIndices,
-                     const float *left, const float *top,
-                     const float *right, const float *bottom)
-{
-    *nbVertices = 4 * 6;
-    *nbIndices = 6 * 6;
-
-    *vertexCoord = malloc(*nbVertices * 3 * sizeof(GLfloat));
-    if (*vertexCoord == NULL)
-        return VLC_ENOMEM;
-    *textureCoord = malloc(nbPlanes * *nbVertices * 2 * sizeof(GLfloat));
-    if (*textureCoord == NULL)
-    {
-        free(*vertexCoord);
-        return VLC_ENOMEM;
-    }
-    *indices = malloc(*nbIndices * sizeof(GLushort));
-    if (*indices == NULL)
-    {
-        free(*textureCoord);
-        free(*vertexCoord);
-        return VLC_ENOMEM;
-    }
-
-    static const GLfloat coord[] = {
-        -1.0,    1.0,    -1.0f, // front
-        -1.0,    -1.0,   -1.0f,
-        1.0,     1.0,    -1.0f,
-        1.0,     -1.0,   -1.0f,
-
-        -1.0,    1.0,    1.0f, // back
-        -1.0,    -1.0,   1.0f,
-        1.0,     1.0,    1.0f,
-        1.0,     -1.0,   1.0f,
-
-        -1.0,    1.0,    -1.0f, // left
-        -1.0,    -1.0,   -1.0f,
-        -1.0,     1.0,    1.0f,
-        -1.0,     -1.0,   1.0f,
-
-        1.0f,    1.0,    -1.0f, // right
-        1.0f,   -1.0,    -1.0f,
-        1.0f,   1.0,     1.0f,
-        1.0f,   -1.0,    1.0f,
-
-        -1.0,    -1.0,    1.0f, // bottom
-        -1.0,    -1.0,   -1.0f,
-        1.0,     -1.0,    1.0f,
-        1.0,     -1.0,   -1.0f,
-
-        -1.0,    1.0,    1.0f, // top
-        -1.0,    1.0,   -1.0f,
-        1.0,     1.0,    1.0f,
-        1.0,     1.0,   -1.0f,
-    };
-
-    memcpy(*vertexCoord, coord, *nbVertices * 3 * sizeof(GLfloat));
-
-    for (unsigned p = 0; p < nbPlanes; ++p)
-    {
-        float width = right[p] - left[p];
-        float height = bottom[p] - top[p];
-
-        float col[] = {left[p],
-                       left[p] + width * 1.f/3,
-                       left[p] + width * 2.f/3,
-                       left[p] + width};
-
-        float row[] = {top[p],
-                       top[p] + height * 1.f/2,
-                       top[p] + height};
-
-        const GLfloat tex[] = {
-            col[1] + padW, row[1] + padH, // front
-            col[1] + padW, row[2] - padH,
-            col[2] - padW, row[1] + padH,
-            col[2] - padW, row[2] - padH,
-
-            col[3] - padW, row[1] + padH, // back
-            col[3] - padW, row[2] - padH,
-            col[2] + padW, row[1] + padH,
-            col[2] + padW, row[2] - padH,
-
-            col[2] - padW, row[0] + padH, // left
-            col[2] - padW, row[1] - padH,
-            col[1] + padW, row[0] + padH,
-            col[1] + padW, row[1] - padH,
-
-            col[0] + padW, row[0] + padH, // right
-            col[0] + padW, row[1] - padH,
-            col[1] - padW, row[0] + padH,
-            col[1] - padW, row[1] - padH,
-
-            col[0] + padW, row[2] - padH, // bottom
-            col[0] + padW, row[1] + padH,
-            col[1] - padW, row[2] - padH,
-            col[1] - padW, row[1] + padH,
-
-            col[2] + padW, row[0] + padH, // top
-            col[2] + padW, row[1] - padH,
-            col[3] - padW, row[0] + padH,
-            col[3] - padW, row[1] - padH,
-        };
-
-        memcpy(*textureCoord + p * *nbVertices * 2, tex,
-               *nbVertices * 2 * sizeof(GLfloat));
-    }
-
-    const GLushort ind[] = {
-        0, 1, 2,       2, 1, 3, // front
-        6, 7, 4,       4, 7, 5, // back
-        10, 11, 8,     8, 11, 9, // left
-        12, 13, 14,    14, 13, 15, // right
-        18, 19, 16,    16, 19, 17, // bottom
-        20, 21, 22,    22, 21, 23, // top
-    };
-
-    memcpy(*indices, ind, *nbIndices * sizeof(GLushort));
-
-    return VLC_SUCCESS;
-}
-
-static int BuildRectangle(unsigned nbPlanes,
-                          GLfloat **vertexCoord, GLfloat **textureCoord, unsigned *nbVertices,
-                          GLushort **indices, unsigned *nbIndices,
-                          const float *left, const float *top,
-                          const float *right, const float *bottom)
-{
-    *nbVertices = 4;
-    *nbIndices = 6;
-
-    *vertexCoord = malloc(*nbVertices * 3 * sizeof(GLfloat));
-    if (*vertexCoord == NULL)
-        return VLC_ENOMEM;
-    *textureCoord = malloc(nbPlanes * *nbVertices * 2 * sizeof(GLfloat));
-    if (*textureCoord == NULL)
-    {
-        free(*vertexCoord);
-        return VLC_ENOMEM;
-    }
-    *indices = malloc(*nbIndices * sizeof(GLushort));
-    if (*indices == NULL)
-    {
-        free(*textureCoord);
-        free(*vertexCoord);
-        return VLC_ENOMEM;
-    }
-
-    static const GLfloat coord[] = {
-       -1.0,    1.0,    -1.0f,
-       -1.0,    -1.0,   -1.0f,
-       1.0,     1.0,    -1.0f,
-       1.0,     -1.0,   -1.0f
-    };
-
-    memcpy(*vertexCoord, coord, *nbVertices * 3 * sizeof(GLfloat));
-
-    for (unsigned p = 0; p < nbPlanes; ++p)
-    {
-        const GLfloat tex[] = {
-            left[p],  top[p],
-            left[p],  bottom[p],
-            right[p], top[p],
-            right[p], bottom[p]
-        };
-
-        memcpy(*textureCoord + p * *nbVertices * 2, tex,
-               *nbVertices * 2 * sizeof(GLfloat));
-    }
-
-    const GLushort ind[] = {
-        0, 1, 2,
-        2, 1, 3
-    };
-
-    memcpy(*indices, ind, *nbIndices * sizeof(GLushort));
-
-    return VLC_SUCCESS;
-}
-
 static int SetupCoords(vout_display_opengl_t *vgl,
                        const float *left, const float *top,
                        const float *right, const float *bottom)
-- 
2.11.0



More information about the vlc-devel mailing list