]> git.tdb.fi Git - geometrycompositor.git/blobdiff - source/control.c
Apply some extra distance in case of bulging curvature
[geometrycompositor.git] / source / control.c
index 292c108bc34538a9399ded9b7672df58fdd1df0e..533bb8093924de35b995c69ce7e06d2c6e3c82ff 100644 (file)
@@ -32,10 +32,10 @@ typedef struct InteractiveView
 static unsigned short frustum_indices[] = { 2, 1, 3, 0, 1, 0xFFFF, 3, 4, 2, 0, 4, 0xFFFF };
 static float view_matrix[] =
 {
-        0.70711f,  0.40825f, -0.57735f, 0.0f,
-        0.0f,      0.81650f,  0.57735f, 0.0f,
-        0.70711f, -0.40725f,  0.57735f, 0.0f,
-       -0.2f,      0.0f,     -2.5f,     1.0f
+        0.70711f,  0.23570f, -0.66667f, 0.0f,
+        0.0f,      0.94281f,  0.33333f, 0.0f,
+        0.70711f, -0.23570f,  0.66667f, 0.0f,
+       -0.2f,      0.0f,     -2.0f,     1.0f
 };
 static float projection_matrix[] =
 {
@@ -383,9 +383,11 @@ int interactive(Display *display, GeometryCorrection *corrections, GeometryCorre
        {
                XEvent event;
                KeySym keysym;
+               int repaint;
 
                XNextEvent(display, &event);
 
+               repaint = 0;
                switch(event.type)
                {
                case KeyPress:
@@ -428,19 +430,26 @@ int interactive(Display *display, GeometryCorrection *corrections, GeometryCorre
                        {
                                update_view(display, &view, &event.xselection);
                                update_pending = 0;
+                               repaint = 1;
                        }
                        break;
+               case Expose:
+                       repaint = 1;
+                       break;
                default:
                        printf("event %d\n", event.type);
                        break;
                }
 
-               glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
-               glUseProgram(view.programs[0]);
-               glDrawElements(GL_TRIANGLE_STRIP, view.nelements, GL_UNSIGNED_SHORT, (void *)(12*sizeof(unsigned short)));
-               glUseProgram(view.programs[1]);
-               glDrawElements(GL_LINE_STRIP, 11, GL_UNSIGNED_SHORT, NULL);
-               glXSwapBuffers(display, view.glx_window);
+               if(repaint)
+               {
+                       glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+                       glUseProgram(view.programs[0]);
+                       glDrawElements(GL_TRIANGLE_STRIP, view.nelements, GL_UNSIGNED_SHORT, (void *)(12*sizeof(unsigned short)));
+                       glUseProgram(view.programs[1]);
+                       glDrawElements(GL_LINE_STRIP, 11, GL_UNSIGNED_SHORT, NULL);
+                       glXSwapBuffers(display, view.glx_window);
+               }
        }
 
        return 0;