Added openGL to automake build. Fixed perspective display.
[familia.git] / src / viewport / drawing_area.c
index 374c87cc724a2015758fd1fecbc4fcbeadd49ef8..9a89fad7763fbc70cf4c6e0ca4d3de0406221739 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "../debug.h"
 #include "drawing_area.h"
+#include "../graphics/individual.h"
 
 /**
  * The "draw" signal handler. All the OpenGL re-drawing should
@@ -17,16 +18,13 @@ gboolean drawing_area_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data)
                return FALSE;
        }
 
-//     glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+       glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
        glPushMatrix ();
                glLoadIdentity ();
+               glTranslatef(0, 0, -10);
                glColor3f (1.0, 1.0, 1.0);
-               glBegin(GL_TRIANGLES);
-                       glVertex3f( 0.0f, 1.0f, 0.0f);    // Top
-                       glVertex3f(-1.0f,-1.0f, 0.0f);    // Bottom Left
-                       glVertex3f( 1.0f,-1.0f, 0.0f);    // Bottom Right
-               glEnd();
+               graphics_render_individual();
        glPopMatrix ();
 
        gtk_widget_end_gl (widget, TRUE);
@@ -62,6 +60,7 @@ gboolean drawing_area_configure_event (GtkWidget *widget,
        w = allocation.width;
        h = allocation.height;
 
+       aspect = w / h;
        /*** OpenGL BEGIN ***/
        if (!gtk_widget_begin_gl (widget))
                return FALSE;
@@ -70,17 +69,8 @@ gboolean drawing_area_configure_event (GtkWidget *widget,
 
        glMatrixMode (GL_PROJECTION);
        glLoadIdentity ();
-
-//     if (w > h) {
-               aspect = w / h;
-//             glFrustum (-aspect, aspect, -1.0, 1.0, 5.0, 60.0);
-//     }
-//     else {
-//             aspect = h / w;
-               glFrustum (-1.0, 1.0, -aspect, aspect, 5.0, 60.0);
-//     }
-
-       glMatrixMode (GL_MODELVIEW);
+       gluPerspective (60.0, aspect, 1.0, 60.0);
+       glMatrixMode(GL_MODELVIEW);
 
        gtk_widget_end_gl (widget, FALSE);
        /*** OpenGL END ***/