Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void drawSpring(float x, float y, float z) {
- glPushMatrix();
- glTranslatef(x, y, z);
- glRotatef(90, 1, 0, 0);
- glBegin(GL_QUADS);
- glColor3f(1.0, 0, 0);
- for (int t = 0; t < 8 * 180; t += 10) {
- for (int u = 0; u < 2 * 180; u += 10) {
- float x = cos(t*3.14 / 180)*(3 + cos(u * 3.14 / 180));
- float y = sin(t * 3.14 / 180)*(3 + cos(u * 3.14 / 180));
- float z = (0.45 + 0.15 * DEIKS)*t * 3.14 / 180 + sin(u * 3.14 / 180);
- glVertex3f(x, y, z);
- u += 10;
- x = cos(t*3.14 / 180)*(3 + cos(u * 3.14 / 180));
- y = sin(t * 3.14 / 180)*(3 + cos(u * 3.14 / 180));
- z = (0.45 + 0.15 * DEIKS)*t * 3.14 / 180 + sin(u * 3.14 / 180);
- glVertex3f(x, y, z);
- t += 10;
- x = cos(t*3.14 / 180)*(3 + cos(u * 3.14 / 180));
- y = sin(t * 3.14 / 180)*(3 + cos(u * 3.14 / 180));
- z = (0.45 + 0.15 * DEIKS)*t * 3.14 / 180 + sin(u * 3.14 / 180);
- glVertex3f(x, y, z);
- u -= 10;
- x = cos(t*3.14 / 180)*(3 + cos(u * 3.14 / 180));
- y = sin(t * 3.14 / 180)*(3 + cos(u * 3.14 / 180));
- z = (0.45 + 0.15 * DEIKS)*t * 3.14 / 180 + sin(u * 3.14 / 180);
- glVertex3f(x, y, z);
- t -= 10;
- }
- }
- glEnd();
- glPopMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement