X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fvframe3d.C;h=f6f0a440cf85fdf41364655287d660387e73465a;hb=21b49090a36821cfe97bdfc573c7fbacc80653d1;hp=3ed62aca30548e2da45e096ed7649e7ffc6c8107;hpb=5820b5f022aeec75ec03f7dd0121aa8a3d7f7590;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/vframe3d.C b/cinelerra-5.1/guicast/vframe3d.C index 3ed62aca..f6f0a440 100644 --- a/cinelerra-5.1/guicast/vframe3d.C +++ b/cinelerra-5.1/guicast/vframe3d.C @@ -152,33 +152,6 @@ void VFrame::to_texture() #endif } -void VFrame::to_ram() -{ -#ifdef HAVE_GL - switch(opengl_state) - { -// Only pbuffer is supported since this is only called after the -// overlay operation onto the pbuffer. - case VFrame::SCREEN: - if(pbuffer) - { - enable_opengl(); -//printf("VFrame::to_ram %d %d\n", get_w(), get_h()); - glReadPixels(0, - 0, - get_w(), - get_h(), - GL_RGB, - GL_UNSIGNED_BYTE, - get_rows()[0]); - flip_vert(); - } - opengl_state = VFrame::RAM; - return; - } -#endif -} - void VFrame::create_pbuffer() { if(pbuffer && @@ -220,12 +193,9 @@ void VFrame::screen_to_texture(int x, int y, int w, int h) #ifdef HAVE_GL // Create texture BC_Texture::new_texture(&texture, - get_w(), - get_h(), - get_color_model()); + get_w(), get_h(), get_color_model()); - if(pbuffer) - { + if(pbuffer) { glEnable(GL_TEXTURE_2D); // Read canvas into texture, use back texture for DOUBLE_BUFFER @@ -247,6 +217,18 @@ void VFrame::screen_to_texture(int x, int y, int w, int h) #endif } +void VFrame::screen_to_ram() +{ +#ifdef HAVE_GL + enable_opengl(); + glReadBuffer(GL_BACK); + int type = BC_CModels::is_float(color_model) ? GL_FLOAT : GL_UNSIGNED_BYTE; + int format = BC_CModels::has_alpha(color_model) ? GL_RGBA : GL_RGB; + glReadPixels(0, 0, get_w(), get_h(), format, type, get_rows()[0]); + opengl_state = VFrame::RAM; +#endif +} + void VFrame::draw_texture(float in_x1, float in_y1, float in_x2,