Added openGL to automake build. Fixed perspective display.
authorRafał Długołęcki <rafal@dlugolecki.net.pl>
Wed, 22 Jan 2014 19:34:46 +0000 (20:34 +0100)
committerRafał Długołęcki <rafal@dlugolecki.net.pl>
Wed, 22 Jan 2014 19:34:46 +0000 (20:34 +0100)
Makefile.am
configure.ac
src/viewport/drawing_area.c

index 7d30f83ceeaf32549614c18fbd5e777803a2dcd9..eec6ff54486e7516d4cde5b8ec89716a72efad3b 100644 (file)
@@ -56,6 +56,7 @@ bin_familia_CPPFLAGS = \
 
 bin_familia_LDADD = \
        $(bin_familia_LIBS) \
+       $(GLU_LIBS) \
        @GEDCOM_LIBS@ \
        -L/usr/lib \
        -lzip
index 4bb406b2c79a44f6dfc00704a18c1fd12ab352c5..4889595a176fca562fa88492bd1e2f1a77d291b0 100644 (file)
@@ -17,6 +17,13 @@ GNOME_COMPILE_WARNINGS([maximum])
 PKG_CHECK_MODULES([bin_familia], [gtk+-3.0 libxml-2.0 gmodule-2.0 gtkglext-3.0])
 
 
+AX_CHECK_GL
+AS_IF([test X$no_gl = Xyes],
+      [AC_MSG_FAILURE([OpenGL is required.])])
+AX_CHECK_GLU
+AM_CONDITIONAL([GLU],[test "$no_glu" != yes])
+
+
 AC_CHECK_PROGS([DOXYGEN], [doxygen])
 if test -z "$DOXYGEN";
        then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
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 ***/