]> git.sesse.net Git - movit/blobdiff - ycbcr_input.cpp
Add support to the ResourcePool for 2D textures.
[movit] / ycbcr_input.cpp
index e089e512d5b7961f88159a3db23e9aa89259943e..2a67ea7158f483cee4a8f25c7bc233df6beab83f 100644 (file)
@@ -87,25 +87,22 @@ YCbCrInput::YCbCrInput(const ImageFormat &image_format,
 
 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.
-       glGenTextures(3, texture_num);
-       check_error();
-
        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();
-               glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE8, widths[channel], heights[channel], 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL);
-               check_error();
        }
 
        needs_update = true;