public
Description: My projects for GL Art at ITP.
Homepage: http://www.candersonmiller.com/
Clone URL: git://github.com/candersonmiller/anderson-miller---itp--glart.git
100755 102 lines (76 sloc) 2.119 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "testApp.h"
 
 
//--------------------------------------------------------------
void testApp::setup(){
counter = 0;
counter1 = 0;
glEnable(GL_DEPTH_TEST);
}
 
//--------------------------------------------------------------
void testApp::update(){
counter += 0.25;
if(counter > 360){
counter = 0;
}
 
counter1 += 0.5;
if(counter1 > 360){
counter1 = 0;
}
 
}
 
//--------------------------------------------------------------
void testApp::draw(){
glMatrixMode(GL_PROJECTION);
gluPerspective(45.0, ofGetScreenWidth()/ofGetScreenHeight(), 10.0, -10.0);
 
glTranslated(700,-300,-500); //origin point
 
//Sun
glPushMatrix();
glTranslated(-225,0,0);
glRotatef(counter,0,1,0);
glColor3f(0.9,0.9,0.00);
glutSolidSphere(150,50,50);
//glutSolidCube(150);
 
//Mars
glPopMatrix();
glPushMatrix();
glColor3f(0.7, 0.2 ,0);
glRotatef(counter, -0.3f, 1.0f,0);
glTranslated(100,100,0); //away from "origin"
glRotatef(counter,0,1,0);
glutSolidSphere(50,50,50);
//glutSolidCube(50);
 
//Mars Moon
glPushMatrix();
glTranslated(-60,0,0);
glRotatef(counter1, 0.1f, 1.0f, 0);
glColor3f(1.0, 1.0,1.0);
glRotatef(counter,0,1,0);
glutSolidSphere(10,50,50);
//glutSolidCube(10);
 
 
//Earth
glPopMatrix();
glPopMatrix();
glColor3f(0,0.6,0);
glTranslated(-200,0,0);
glRotatef(counter1 , 0.0f, 1.0f, 0.0f);
glTranslated(-400,-20,0);
glRotatef(counter,0,1,0);
//glutSolidCube(60);
glutSolidSphere(60,50,50);
 
 
 
 
}
 
//--------------------------------------------------------------
void testApp::keyPressed (int key){
 
}
 
//--------------------------------------------------------------
void testApp::keyReleased (int key){
 
}
 
//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){
}
 
//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
}
 
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
}
 
//--------------------------------------------------------------
void testApp::mouseReleased(){
 
}