enabled copping

This commit is contained in:
jojo61
2018-10-12 15:12:30 +02:00
parent b1f79c423a
commit 130c3e90a0
3 changed files with 61 additions and 51 deletions

View File

@@ -169,7 +169,13 @@ struct vertex_pt {
float x, y;
};
struct vertex_pi {
GLint x, y;
};
#define TEXUNIT_VIDEO_NUM 6
struct vertex {
struct vertex_pt position;
struct vertex_pt texcoord[TEXUNIT_VIDEO_NUM];
@@ -187,7 +193,6 @@ static const struct gl_vao_entry vertex_vao[] = {
};
static void compile_attach_shader(GLuint program,
GLenum type, const char *source)
{
@@ -292,7 +297,7 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace) {
return gl_prog;
}
static void render_pass_quad(int flip)
static void render_pass_quad(int flip, float xcrop, float ycrop)
{
struct vertex va[4];
int n;
@@ -317,24 +322,26 @@ static void render_pass_quad(int flip)
va[3].position.x = (float) 1.0;
va[3].position.y = (float) 1.0;
}
va[0].texcoord[0].x = (float) 0.0;
va[0].texcoord[0].y = (float) 0.0;
va[0].texcoord[1].x = (float) 0.0;
va[0].texcoord[1].y = (float) 0.0;
va[1].texcoord[0].x = (float) 0.0;
va[1].texcoord[0].y = (float) 1.0;
va[1].texcoord[1].x = (float) 0.0;
va[1].texcoord[1].y = (float) 1.0;
va[2].texcoord[0].x = (float) 1.0;
va[2].texcoord[0].y = (float) 0.0;
va[2].texcoord[1].x = (float) 1.0;
va[2].texcoord[1].y = (float) 0.0;
va[3].texcoord[0].x = (float) 1.0;
va[3].texcoord[0].y = (float) 1.0;
va[3].texcoord[1].x = (float) 1.0;
va[3].texcoord[1].y = (float) 1.0;
va[0].texcoord[0].x = (float) 0.0 + xcrop;
va[0].texcoord[0].y = (float) 0.0 + ycrop; // abgeschnitten von links oben
va[0].texcoord[1].x = (float) 0.0 + xcrop;
va[0].texcoord[1].y = (float) 0.0 + ycrop; // abgeschnitten von links oben
va[1].texcoord[0].x = (float) 0.0 + xcrop;
va[1].texcoord[0].y = (float) 1.0 - ycrop; // abgeschnitten links unten 1.0 - Wert
va[1].texcoord[1].x = (float) 0.0 + xcrop;
va[1].texcoord[1].y = (float) 1.0 - ycrop; // abgeschnitten links unten 1.0 - Wert
va[2].texcoord[0].x = (float) 1.0 - xcrop;
va[2].texcoord[0].y = (float) 0.0 + ycrop; // abgeschnitten von rechts oben
va[2].texcoord[1].x = (float) 1.0 - xcrop;
va[2].texcoord[1].y = (float) 0.0 + ycrop; // abgeschnitten von rechts oben
va[3].texcoord[0].x = (float) 1.0 - xcrop;
va[3].texcoord[0].y = (float) 1.0 - ycrop; // abgeschnitten von rechts unten 1.0 - wert
va[3].texcoord[1].x = (float) 1.0 - xcrop;
va[3].texcoord[1].y = (float) 1.0 - ycrop; // abgeschnitten von rechts unten 1.0 - wert
glBindBuffer(GL_ARRAY_BUFFER, vao_buffer);
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(struct vertex), va, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);