]> git.sesse.net Git - movit/blobdiff - ycbcr_input.cpp
Fix YCbCrInput after the ResourcePool texture changes.
[movit] / ycbcr_input.cpp
index e089e512d5b7961f88159a3db23e9aa89259943e..87140be7828064535972aa10d75cb4675ba11124 100644 (file)
@@ -6,6 +6,7 @@
 #include <string.h>
 
 #include "effect_util.h"
 #include <string.h>
 
 #include "effect_util.h"
+#include "resource_pool.h"
 #include "util.h"
 #include "ycbcr_input.h"
 
 #include "util.h"
 #include "ycbcr_input.h"
 
@@ -87,25 +88,22 @@ YCbCrInput::YCbCrInput(const ImageFormat &image_format,
 
 YCbCrInput::~YCbCrInput()
 {
 
 YCbCrInput::~YCbCrInput()
 {
-       if (texture_num[0] != 0) {
-               glDeleteTextures(3, texture_num);
-               check_error();
+       for (unsigned channel = 0; channel < 3; ++channel) {
+               if (texture_num[channel] != 0) {
+                       resource_pool->release_2d_texture(texture_num[channel]);
+               }
        }
 }
 
 void YCbCrInput::finalize()
 {
        // Create the textures themselves.
        }
 }
 
 void YCbCrInput::finalize()
 {
        // Create the textures themselves.
-       glGenTextures(3, texture_num);
-       check_error();
-
        for (unsigned channel = 0; channel < 3; ++channel) {
        for (unsigned channel = 0; channel < 3; ++channel) {
+               texture_num[channel] = resource_pool->create_2d_texture(GL_LUMINANCE8, widths[channel], heights[channel]);
                glBindTexture(GL_TEXTURE_2D, texture_num[channel]);
                check_error();
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
                check_error();
                glBindTexture(GL_TEXTURE_2D, texture_num[channel]);
                check_error();
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
                check_error();
-               glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE8, widths[channel], heights[channel], 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL);
-               check_error();
        }
 
        needs_update = true;
        }
 
        needs_update = true;