X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbctexture.C;h=d9bc92d94869d67e314cc907d0495f3b8d16be27;hb=efc8fa7dc7ddcdeaa9398e09d81975a6ccf526fc;hp=1ecbfd35c856b9271b6ed6ce51e852b32a9185da;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bctexture.C b/cinelerra-5.1/guicast/bctexture.C index 1ecbfd35..d9bc92d9 100644 --- a/cinelerra-5.1/guicast/bctexture.C +++ b/cinelerra-5.1/guicast/bctexture.C @@ -186,6 +186,21 @@ int BC_Texture::get_window_id() } +void BC_Texture::draw_texture( + float in_x1, float in_y1, float in_x2, float in_y2, + float out_x1, float out_y1, float out_x2, float out_y2) +{ +#ifdef HAVE_GL + glBegin(GL_QUADS); + glNormal3f(0, 0, 1.0); + glTexCoord2f(in_x1, in_y1); glVertex3f(out_x1, out_y1, 0); + glTexCoord2f(in_x2, in_y1); glVertex3f(out_x2, out_y1, 0); + glTexCoord2f(in_x2, in_y2); glVertex3f(out_x2, out_y2, 0); + glTexCoord2f(in_x1, in_y2); glVertex3f(out_x1, out_y2, 0); + glEnd(); +#endif +} + void BC_Texture::bind(int texture_unit) { #ifdef HAVE_GL @@ -212,3 +227,20 @@ void BC_Texture::bind(int texture_unit) #endif } +void write_ppm(uint8_t *tp, int w, int h, const char *fmt, ...); + +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); + int w = get_texture_w(), h = get_texture_h(); + uint8_t img[w*h*3]; + glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, img); + write_ppm(img, w, h, "%s", fn); + glActiveTexture(prev_id); +#endif +} + +