git.ucc.asn.au
/
atyndall
/
cits2231.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(no commit message)
[atyndall/cits2231.git]
/
scene.c
diff --git
a/scene.c
b/scene.c
index
3d5583f
..
a9a5d6b
100644
(file)
--- a/
scene.c
+++ b/
scene.c
@@
-10,6
+10,7
@@
#include <math.h>
\r
#include <GL/gl.h>
\r
#include <GL/glut.h>
\r
#include <math.h>
\r
#include <GL/gl.h>
\r
#include <GL/glut.h>
\r
+#include <time.h>
\r
\r
#include "bitmap.h"
\r
\r
\r
#include "bitmap.h"
\r
\r
@@
-483,8
+484,8
@@
void makeMenu() {
* @param h New height
\r
*/
\r
void windowReshape(int w, int h) {
\r
* @param h New height
\r
*/
\r
void windowReshape(int w, int h) {
\r
- GLdouble near = -10.0;
\r
- GLdouble far = 10.0;
\r
+ GLdouble near = -10
00
.0;
\r
+ GLdouble far = 10
00
.0;
\r
\r
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
\r
glMatrixMode(GL_PROJECTION);
\r
\r
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
\r
glMatrixMode(GL_PROJECTION);
\r
@@
-508,7
+509,7
@@
void windowReshape(int w, int h) {
*/
\r
/*void mouse(int btn, int state, int x, int y) {
\r
\r
*/
\r
/*void mouse(int btn, int state, int x, int y) {
\r
\r
-}*/
\r
+}*/
/*
\r
static void
\r
mouse(int button, int state, int x, int y)
\r
{
\r
static void
\r
mouse(int button, int state, int x, int y)
\r
{
\r
@@
-551,8
+552,15
@@
motion(int x, int y)
lightStartY = y;
\r
glutPostRedisplay();
\r
}
\r
lightStartY = y;
\r
glutPostRedisplay();
\r
}
\r
-}
\r
+}
*/
\r
\r
\r
+void idle() {
\r
+ angle = (int)(angle + 10) % 360;
\r
+ //angle2 = (int)(angle2 + 10) % 360;
\r
+ printf("Angle 1: %f, Angle 2: %f\n", angle, angle2);
\r
+ sleep(2);
\r
+ glutPostRedisplay();
\r
+}
\r
\r
/**
\r
* Draw a floor.
\r
\r
/**
\r
* Draw a floor.
\r
@@
-564,7
+572,7
@@
void drawFloor() {
// glEnable(GL_TEXTURE_2D);
\r
//}
\r
\r
// glEnable(GL_TEXTURE_2D);
\r
//}
\r
\r
-
/*
glBegin(GL_QUADS);
\r
+ glBegin(GL_QUADS);
\r
glTexCoord2f(0.0, 0.0);
\r
glVertex3fv(floorVertices[0]);
\r
glTexCoord2f(0.0, 16.0);
\r
glTexCoord2f(0.0, 0.0);
\r
glVertex3fv(floorVertices[0]);
\r
glTexCoord2f(0.0, 16.0);
\r
@@
-573,7
+581,7
@@
void drawFloor() {
glVertex3fv(floorVertices[2]);
\r
glTexCoord2f(16.0, 0.0);
\r
glVertex3fv(floorVertices[3]);
\r
glVertex3fv(floorVertices[2]);
\r
glTexCoord2f(16.0, 0.0);
\r
glVertex3fv(floorVertices[3]);
\r
- glEnd();
*/
\r
+ glEnd();
\r
\r
/*if (useTexture) {
\r
glDisable(GL_TEXTURE_2D);
\r
\r
/*if (useTexture) {
\r
glDisable(GL_TEXTURE_2D);
\r
@@
-615,7
+623,6
@@
void display() {
glPushMatrix();
\r
\r
//glTranslatef(0.0, 0.0, 0.0);
\r
glPushMatrix();
\r
\r
//glTranslatef(0.0, 0.0, 0.0);
\r
-
\r
glutWireTeapot(30); // Draw teapot for test
\r
glPopMatrix();
\r
\r
glutWireTeapot(30); // Draw teapot for test
\r
glPopMatrix();
\r
\r
@@
-643,10
+650,10
@@
void init() {
glLoadIdentity();
\r
\r
gluPerspective(
\r
glLoadIdentity();
\r
\r
gluPerspective(
\r
- 60.0, /* field of view in degree */
\r
- 1.0, /* aspect ratio */
\r
-
0.0, /* Z near */
\r
-
9
00.0 /* Z far */
\r
+
60.0, /* field of view in degree */
\r
+ 1.0, /* aspect ratio */
\r
+
-100
0.0, /* Z near */
\r
+
10
00.0 /* Z far */
\r
);
\r
\r
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
\r
);
\r
\r
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
\r
@@
-692,14
+699,15
@@
int main(int argc, char **argv) {
glDepthFunc(GL_LEQUAL); // the type
\r
glEnable(GL_CULL_FACE);
\r
glEnable(GL_TEXTURE_2D);
\r
glDepthFunc(GL_LEQUAL); // the type
\r
glEnable(GL_CULL_FACE);
\r
glEnable(GL_TEXTURE_2D);
\r
- glLineWidth(
3
.0);
\r
+ glLineWidth(
1
.0);
\r
\r
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
\r
\r
glutReshapeFunc(windowReshape);
\r
glutDisplayFunc(display);
\r
\r
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
\r
\r
glutReshapeFunc(windowReshape);
\r
glutDisplayFunc(display);
\r
- glutMouseFunc(mouse);
\r
- glutMotionFunc(motion);
\r
+ //glutMouseFunc(mouse);
\r
+ //glutMotionFunc(motion);
\r
+ glutIdleFunc(idle);
\r
\r
makeMenu();
\r
\r
\r
makeMenu();
\r
\r
UCC
git Repository :: git.ucc.asn.au