#include <GL/glut.h>
#include <math.h>
#include <stdio.h>
Go to the source code of this file.
|
void | reshape (GLint w, GLint h) |
|
void | display () |
|
void | timer (int v) |
|
void | mouse (int button, int state, int x, int y) |
|
void | init () |
|
int | main (int argc, char **argv) |
|
◆ pi
◆ display()
Definition at line 70 of file torus_animated.c.
72 glClear(GL_COLOR_BUFFER_BIT);
73 glMatrixMode(GL_MODELVIEW);
76 glColor3f(1.0, 1.0, 1.0);
78 glutWireTorus(0.5, 3, 15, 30);
static GLfloat current_rot
References current_rot.
Referenced by main().
◆ init()
Definition at line 130 of file torus_animated.c.
131 glClearColor(0.0, 0.0, 0.0, 1.0);
132 glColor3f(1.0, 1.0, 1.0);
134 glMatrixMode(GL_PROJECTION);
136 gluPerspective(60.0, 4.0 / 3.0, 1, 40);
138 glMatrixMode(GL_MODELVIEW);
140 gluLookAt(4, 6, 5, 0, 0, 0, 0, 1, 0);
Referenced by main().
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 143 of file torus_animated.c.
144 glutInit(&argc, argv);
145 glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
148 glutInitWindowPosition(80, 80);
149 glutInitWindowSize(1000, 800);
150 glutCreateWindow(
"A Torus on a Plane");
157 glutTimerFunc(100,
timer, 0);
158 glutMouseFunc(
mouse);
void reshape(GLint w, GLint h)
void mouse(int button, int state, int x, int y)
References display(), init(), mouse(), reshape(), and timer().
◆ mouse()
void mouse |
( |
int |
button, |
|
|
int |
state, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| |
Definition at line 122 of file torus_animated.c.
123 if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) {
125 }
else if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN) {
References spinning.
Referenced by main().
◆ reshape()
void reshape |
( |
GLint |
w, |
|
|
GLint |
h |
|
) |
| |
Definition at line 51 of file torus_animated.c.
52 glViewport(0, 0, w, h);
53 GLfloat aspect = (GLfloat)w / (GLfloat)h;
54 glMatrixMode(GL_PROJECTION);
59 glOrtho(-50.0, 50.0, -50.0 / aspect, 50.0 / aspect, -1.0, 1.0);
66 glOrtho(-10.0 * aspect, 10.0 * aspect, -10.0, 10.0, -1.0, 1.0);
Referenced by main().
◆ timer()
◆ current_rot
GLfloat current_rot = 0.0 |
|
static |
◆ FPS
◆ spinning