#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 38 of file openGL_torus_animated.c.
40 glClear(GL_COLOR_BUFFER_BIT);
41 glMatrixMode(GL_MODELVIEW);
44 glColor3f(1.0, 1.0, 1.0);
46 glutWireTorus(0.5, 3, 15, 30);
static GLfloat current_rot
References current_rot.
Referenced by main().
◆ init()
Definition at line 98 of file openGL_torus_animated.c.
99 glClearColor(0.0, 0.0, 0.0, 1.0);
100 glColor3f(1.0, 1.0, 1.0);
102 glMatrixMode(GL_PROJECTION);
104 gluPerspective(60.0, 4.0 / 3.0, 1, 40);
106 glMatrixMode(GL_MODELVIEW);
108 gluLookAt(4, 6, 5, 0, 0, 0, 0, 1, 0);
Referenced by main().
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 111 of file openGL_torus_animated.c.
112 glutInit(&argc, argv);
113 glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
116 glutInitWindowPosition(80, 80);
117 glutInitWindowSize(1000, 800);
118 glutCreateWindow(
"A Torus on a Plane");
125 glutTimerFunc(100,
timer, 0);
126 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 90 of file openGL_torus_animated.c.
91 if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) {
93 }
else if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN) {
References spinning.
Referenced by main().
◆ reshape()
void reshape |
( |
GLint |
w, |
|
|
GLint |
h |
|
) |
| |
Definition at line 19 of file openGL_torus_animated.c.
20 glViewport(0, 0, w, h);
21 GLfloat aspect = (GLfloat)w / (GLfloat)h;
22 glMatrixMode(GL_PROJECTION);
27 glOrtho(-50.0, 50.0, -50.0 / aspect, 50.0 / aspect, -1.0, 1.0);
34 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