From: Rafał Długołęcki Date: Wed, 22 Jan 2014 19:34:46 +0000 (+0100) Subject: Added openGL to automake build. Fixed perspective display. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=f1abdf57b72348c13302e143753ef0da0d51eba5;p=familia.git Added openGL to automake build. Fixed perspective display. --- diff --git a/Makefile.am b/Makefile.am index 7d30f83..eec6ff5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,6 +56,7 @@ bin_familia_CPPFLAGS = \ bin_familia_LDADD = \ $(bin_familia_LIBS) \ + $(GLU_LIBS) \ @GEDCOM_LIBS@ \ -L/usr/lib \ -lzip diff --git a/configure.ac b/configure.ac index 4bb406b..4889595 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/src/viewport/drawing_area.c b/src/viewport/drawing_area.c index 374c87c..9a89fad 100644 --- a/src/viewport/drawing_area.c +++ b/src/viewport/drawing_area.c @@ -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 ***/