fix make_shader segment count, repair mask tweak keyfrm updates for xlat,rotate,scale
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / vframe3d.C
index 30c1b2bea23656a7873329b63c4e84c4841989db..d7d4af0a222f317bd6730cef3a3bea42c6f2b60a 100644 (file)
@@ -179,7 +179,6 @@ void VFrame::screen_to_texture(int x, int y, int w, int h)
 // Create texture
        BC_Texture::new_texture(&texture,
                get_w(), get_h(), get_color_model());
 // Create texture
        BC_Texture::new_texture(&texture,
                get_w(), get_h(), get_color_model());
-
        if(pbuffer) {
                glEnable(GL_TEXTURE_2D);
 
        if(pbuffer) {
                glEnable(GL_TEXTURE_2D);
 
@@ -237,20 +236,15 @@ void VFrame::draw_texture(int flip_y)
 }
 
 
 }
 
 
-void VFrame::bind_texture(int texture_unit)
+void VFrame::bind_texture(int texture_unit, int nearest)
 {
 // Bind the texture
 {
 // Bind the texture
-       if(texture)
-       {
-               texture->bind(texture_unit);
+       if(texture) {
+               texture->bind(texture_unit, nearest);
        }
 }
 
 
        }
 }
 
 
-
-
-
-
 void VFrame::init_screen(int w, int h)
 {
 #ifdef HAVE_GL
 void VFrame::init_screen(int w, int h)
 {
 #ifdef HAVE_GL
@@ -266,7 +260,7 @@ void VFrame::init_screen(int w, int h)
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
 // Shift down and right so 0,0 is the top left corner
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
 // Shift down and right so 0,0 is the top left corner
-       glTranslatef(-(w-1)/2.f, (h-1)/2.f, 0.0);
+       glTranslatef(-w/2.f, h/2.f, 0.f);
        glTranslatef(0.0, 0.0, -(far + near) / 2);
 
        glDisable(GL_DEPTH_TEST);
        glTranslatef(0.0, 0.0, -(far + near) / 2);
 
        glDisable(GL_DEPTH_TEST);
@@ -404,13 +398,16 @@ unsigned int VFrame::make_shader(const char **segments, ...)
        unsigned int program = 0;
 #ifdef HAVE_GL
 // Construct single source file out of arguments
        unsigned int program = 0;
 #ifdef HAVE_GL
 // Construct single source file out of arguments
-       int nb_segs = 1;
-       if( !segments ) {
+       int nb_segs = 0;
+       if( !segments ) {  // arg list
                va_list list;  va_start(list, segments);
                while( va_arg(list, char*) != 0 ) ++nb_segs;
                va_end(list);
        }
                va_list list;  va_start(list, segments);
                while( va_arg(list, char*) != 0 ) ++nb_segs;
                va_end(list);
        }
-       const char *segs[nb_segs];
+       else { // segment list
+               while( segments[nb_segs] ) ++nb_segs;
+       }
+       const char *segs[++nb_segs];
        if( !segments ) {
                va_list list;  va_start(list, segments);
                for( int i=0; i<nb_segs; ++i )
        if( !segments ) {
                va_list list;  va_start(list, segments);
                for( int i=0; i<nb_segs; ++i )