X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbctexture.C;h=e3eda5fa407fe4de9e5d8c2d26742fad9cb95872;hb=ba9e9e32512994d5bccdd782bce844b2338992b7;hp=1d0f7e88fece46ce03b49a819d7e16dda216acc0;hpb=7ead9f7382846e81c2f8efb25780014e5f8834c3;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/guicast/bctexture.C b/cinelerra-5.1/guicast/bctexture.C index 1d0f7e88..e3eda5fa 100644 --- a/cinelerra-5.1/guicast/bctexture.C +++ b/cinelerra-5.1/guicast/bctexture.C @@ -196,7 +196,7 @@ void BC_Texture::draw_texture( #endif } -void BC_Texture::bind(int texture_unit) +void BC_Texture::bind(int texture_unit, int nearest) { #ifdef HAVE_GL // Bind the texture @@ -205,10 +205,10 @@ void BC_Texture::bind(int texture_unit) if(texture_unit >= 0) glActiveTexture(GL_TEXTURE0 + texture_unit); glBindTexture(GL_TEXTURE_2D, texture_id); glEnable(GL_TEXTURE_2D); - if(texture_unit >= 0) - { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + if(texture_unit >= 0) { + int filter = nearest ? GL_NEAREST : GL_LINEAR; + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); // GL_REPEAT in this case causes the upper left corners of the masks // to blur. @@ -249,7 +249,7 @@ void BC_Texture::write_tex(const char *fn, int id) uint8_t *img = new uint8_t[w*h*3]; glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, img); write_ppm(img, w, h, "%s", fn); - delete img; + delete [] img; glActiveTexture(prev_id); #endif }