dlugolecki.net.pl
Dziennik
Polecane
Software
projects
/
familia.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
TODO: Add children by their age.
[familia.git]
/
src
/
viewport
/
drawing_area.c
diff --git
a/src/viewport/drawing_area.c
b/src/viewport/drawing_area.c
index 07e916609d20369bc860d8087173f9b96b866326..374c87cc724a2015758fd1fecbc4fcbeadd49ef8 100644
(file)
--- 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;
}
return FALSE;
}
-
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
//
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix ();
glPushMatrix ();
+ glLoadIdentity ();
glColor3f (1.0, 1.0, 1.0);
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);
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;
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;
gtk_widget_get_allocation (widget, &allocation);
w = allocation.width;
@@
-65,7
+71,14
@@
gboolean drawing_area_configure_event (GtkWidget *widget,
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
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);
glMatrixMode (GL_MODELVIEW);