X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=ycbcr_input.cpp;h=87140be7828064535972aa10d75cb4675ba11124;hp=e089e512d5b7961f88159a3db23e9aa89259943e;hb=a164e03033bce0a1fff8044468b12e600722b188;hpb=9cf78e3b5a801b7841133011f74fc7962861705d diff --git a/ycbcr_input.cpp b/ycbcr_input.cpp index e089e51..87140be 100644 --- a/ycbcr_input.cpp +++ b/ycbcr_input.cpp @@ -6,6 +6,7 @@ #include #include "effect_util.h" +#include "resource_pool.h" #include "util.h" #include "ycbcr_input.h" @@ -87,25 +88,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;