summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Davis <afd@ti.com>2025-07-16 14:08:01 -0500
committerAndrew Davis <afd@ti.com>2025-07-25 11:33:33 -0500
commite365dccf1e11959d6fc5018bffc5a859104f8af4 (patch)
tree55cd2f08d0d0e1685fdd95bafafc4e2c5cc923dd
parentb051ddd7e0b5dcec5f46385b461860001db8abc0 (diff)
cube-video: Do not setup texture parameters each draw
We do not need to delete and re-generate our texture object at the end of video, keep the same object. This allows us to set the texture parameters for this texture object as part of init and not each draw loop. Signed-off-by: Andrew Davis <afd@ti.com>
-rw-r--r--cube-video.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/cube-video.c b/cube-video.c
index 3ee855a..a0ea4d3 100644
--- a/cube-video.c
+++ b/cube-video.c
@@ -234,8 +234,6 @@ static void draw_cube_video(unsigned i)
frame = video_frame(gl.decoder);
if (!frame) {
/* end of stream */
- glDeleteTextures(1, &gl.tex);
- glGenTextures(1, &gl.tex);
video_deinit(gl.decoder);
gl.idx = (gl.idx + 1) % gl.filenames_count;
gl.decoder = video_init(gl.egl, gl.gbm, gl.filenames[gl.idx]);
@@ -245,10 +243,6 @@ static void draw_cube_video(unsigned i)
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_EXTERNAL_OES, gl.tex);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
gl.egl->glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, frame);
/* clear the color buffer */
@@ -372,6 +366,11 @@ const struct cube * init_cube_video(const struct egl *egl, const struct gbm *gbm
glEnableVertexAttribArray(2);
glGenTextures(1, &gl.tex);
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, gl.tex);
+ glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glClearColor(0.5, 0.5, 0.5, 1.0);