[gtkglarea] exaples/viewlw.c: replace gluPerspective()
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkglarea] exaples/viewlw.c: replace gluPerspective()
- Date: Mon, 7 Apr 2014 15:34:31 +0000 (UTC)
commit 92f9273e9152cbc53cacc753c5b0abb751e157fb
Author: Javier Jardón <jjardon gnome org>
Date: Mon Apr 7 13:58:26 2014 +0100
exaples/viewlw.c: replace gluPerspective()
examples/viewlw.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/examples/viewlw.c b/examples/viewlw.c
index 428ae35..b607c9d 100644
--- a/examples/viewlw.c
+++ b/examples/viewlw.c
@@ -22,7 +22,6 @@
#include <gtk/gtk.h>
#include <gtkgl/gtkglarea.h>
#include <GL/gl.h>
-#include <GL/glu.h>
#include "trackball.h"
@@ -93,6 +92,15 @@ void initgl(void)
glEnable(GL_COLOR_MATERIAL);
}
+void perspectiveGL(GLdouble fovY, GLdouble aspect, GLdouble zNear, GLdouble zFar)
+{
+ GLdouble fW, fH;
+
+ fH = tan(fovY / 360 * M_PI) * zNear;
+ fW = fH * aspect;
+ glFrustum(-fW, fW, -fH, fH, zNear, zFar);
+}
+
gint glarea_expose(GtkWidget *widget, GdkEventExpose *event)
{
GLfloat m[4][4];
@@ -116,7 +124,7 @@ gint glarea_expose(GtkWidget *widget, GdkEventExpose *event)
/* view */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- gluPerspective(info->zoom, VIEW_ASPECT, 1,100);
+ perspectiveGL(info->zoom, VIEW_ASPECT, 1, 100);
glMatrixMode(GL_MODELVIEW);
/* draw object */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]