X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbctexture.C;h=b527b4e137327ab853a7528958907338d30b56d2;hp=ef77f8ea35422cf07a5e7e06586518f89e098d34;hb=c279e21fc2394a7908bbd1ba8c79b116fe9fb14a;hpb=87141f1b454130848c34efdea9cf832d17463830 diff --git a/cinelerra-5.1/guicast/bctexture.C b/cinelerra-5.1/guicast/bctexture.C index ef77f8ea..b527b4e1 100644 --- a/cinelerra-5.1/guicast/bctexture.C +++ b/cinelerra-5.1/guicast/bctexture.C @@ -227,10 +227,24 @@ void BC_Texture::bind(int texture_unit) #endif } -void write_ppm(uint8_t *tp, int w, int h, const char *fmt, ...); +#ifdef HAVE_GL +static void write_ppm(uint8_t *tp, int w, int h, const char *fmt, ...) +{ + va_list ap; va_start(ap, fmt); + char fn[256]; vsnprintf(fn, sizeof(fn), fmt, ap); + va_end(ap); + FILE *fp = !strcmp(fn,"-") ? stdout : fopen(fn,"w"); + if( fp ) { + fprintf(fp,"P6\n%d %d\n255\n",w,h); + fwrite(tp,3*w,h,fp); + if( fp != stdout ) fclose(fp); + } +} +#endif void BC_Texture::write_tex(const char *fn) { +#ifdef HAVE_GL int prev_id = -1; glGetIntegerv(GL_ACTIVE_TEXTURE, &prev_id); glActiveTexture(this->texture_id); @@ -239,6 +253,7 @@ void BC_Texture::write_tex(const char *fn) glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, img); write_ppm(img, w, h, "%s", fn); glActiveTexture(prev_id); +#endif }