mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-20 06:08:14 +00:00
eglglessink: Decouple texture and vertex positions
This commit is contained in:
parent
cb034b2ecd
commit
dafcdb0da3
2 changed files with 43 additions and 5 deletions
|
@ -140,6 +140,7 @@ static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC my_glEGLImageTargetTexture2DOES;
|
|||
/* *INDENT-OFF* */
|
||||
static const char *vert_COPY_prog = {
|
||||
"attribute vec3 position;"
|
||||
"attribute vec2 texpos;"
|
||||
"varying vec2 opos;"
|
||||
"void main(void)"
|
||||
"{"
|
||||
|
@ -1151,12 +1152,25 @@ gst_eglglessink_setup_vbo (GstEglGlesSink * eglglessink, gboolean reset)
|
|||
eglglessink->coordarray[3].y = -1;
|
||||
eglglessink->coordarray[3].z = 0;
|
||||
|
||||
eglglessink->texarray[0].x = 1;
|
||||
eglglessink->texarray[0].y = 1;
|
||||
|
||||
eglglessink->texarray[1].x = 1;
|
||||
eglglessink->texarray[1].y = -1;
|
||||
|
||||
eglglessink->texarray[2].x = -1;
|
||||
eglglessink->texarray[2].y = 1;
|
||||
|
||||
eglglessink->texarray[3].x = -1;
|
||||
eglglessink->texarray[3].y = -1;
|
||||
|
||||
eglglessink->indexarray[0] = 0;
|
||||
eglglessink->indexarray[1] = 1;
|
||||
eglglessink->indexarray[2] = 2;
|
||||
eglglessink->indexarray[3] = 3;
|
||||
|
||||
glGenBuffers (1, &eglglessink->vdata);
|
||||
glGenBuffers (1, &eglglessink->tdata);
|
||||
glGenBuffers (1, &eglglessink->idata);
|
||||
if (got_gl_error ("glGenBuffers"))
|
||||
goto HANDLE_ERROR_LOCKED;
|
||||
|
@ -1178,6 +1192,23 @@ gst_eglglessink_setup_vbo (GstEglGlesSink * eglglessink, gboolean reset)
|
|||
if (got_gl_error ("glEnableVertexAttribArray"))
|
||||
goto HANDLE_ERROR_LOCKED;
|
||||
|
||||
glBindBuffer (GL_ARRAY_BUFFER, eglglessink->tdata);
|
||||
if (got_gl_error ("glBindBuffer tdata"))
|
||||
goto HANDLE_ERROR_LOCKED;
|
||||
|
||||
glBufferData (GL_ARRAY_BUFFER, sizeof (eglglessink->texarray),
|
||||
eglglessink->texarray, GL_STATIC_DRAW);
|
||||
if (got_gl_error ("glBufferData tdata"))
|
||||
goto HANDLE_ERROR_LOCKED;
|
||||
|
||||
glVertexAttribPointer (1, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
if (got_gl_error ("glVertexAttribPointer"))
|
||||
goto HANDLE_ERROR_LOCKED;
|
||||
|
||||
glEnableVertexAttribArray (1);
|
||||
if (got_gl_error ("glEnableVertexAttribArray"))
|
||||
goto HANDLE_ERROR_LOCKED;
|
||||
|
||||
glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, eglglessink->idata);
|
||||
if (got_gl_error ("glBindBuffer idata"))
|
||||
goto HANDLE_ERROR_LOCKED;
|
||||
|
|
|
@ -87,12 +87,18 @@ typedef enum {
|
|||
GST_EGLGLESSINK_RENDER_FAST
|
||||
} GstEglGlesSinkRenderingPath;
|
||||
|
||||
typedef struct _coord
|
||||
typedef struct _coord2
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
} coord2;
|
||||
|
||||
typedef struct _coord3
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
} coord;
|
||||
} coord3;
|
||||
|
||||
struct _GstEglGlesImageFmt
|
||||
{
|
||||
|
@ -150,9 +156,10 @@ struct _GstEglGlesSink
|
|||
GstEglGlesSinkRenderingPath rendering_path;
|
||||
|
||||
/* shader vars */
|
||||
coord coordarray[4];
|
||||
coord3 coordarray[4];
|
||||
coord2 texarray[4];
|
||||
unsigned short indexarray[4];
|
||||
unsigned int vdata, idata;
|
||||
unsigned int vdata, tdata, idata;
|
||||
|
||||
/* props */
|
||||
gboolean silent;
|
||||
|
|
Loading…
Reference in a new issue