X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;ds=sidebyside;f=src%2Fviewport%2Fdrawing_area.c;fp=src%2Fviewport%2Fdrawing_area.c;h=374c87cc724a2015758fd1fecbc4fcbeadd49ef8;hb=4332a173c913ba3b3db75c5be52d9aca20b64aac;hp=07e916609d20369bc860d8087173f9b96b866326;hpb=bdf18a363c63afa475622f2db7bec17a69f89669;p=familia.git diff --git a/src/viewport/drawing_area.c b/src/viewport/drawing_area.c index 07e9166..374c87c 100644 --- a/src/viewport/drawing_area.c +++ b/src/viewport/drawing_area.c @@ -17,10 +17,16 @@ 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 (); 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(); glPopMatrix (); gtk_widget_end_gl (widget, TRUE); @@ -49,8 +55,8 @@ gboolean drawing_area_configure_event (GtkWidget *widget, GLfloat width = 0; /* Current page height */ GLfloat height = 0; - /* Current page */ - struct order_page *page = NULL; + /* Aspect ratio */ + GLfloat aspect = 0; gtk_widget_get_allocation (widget, &allocation); w = allocation.width; @@ -65,7 +71,14 @@ gboolean drawing_area_configure_event (GtkWidget *widget, glMatrixMode (GL_PROJECTION); glLoadIdentity (); - /* Code was here */ +// 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);