Commit 5f54af5bd29311434eee0930989babd057bfb7c5
1 parent
9650806e
added the skeleton gl_spider.h class
Showing
1 changed file
with
0 additions
and
117 deletions
Show diff stats
gl/TextureTest.c deleted
1 | - | |
2 | - GLfloat Normals[6][3] = | |
3 | - {{ -1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {1.0, 0.0, 0.0}, | |
4 | - {0.0, -1.0, 0.0}, {0.0, 0.0, 1.0}, {0.0, 0.0, -1.0}}; | |
5 | - GLint faces[6][4] = | |
6 | - {{0, 1, 2, 3}, {3, 2, 6, 7}, {7, 6, 5, 4}, | |
7 | - {4, 5, 1, 0}, {5, 6, 2, 1}, {7, 4, 0, 3}}; | |
8 | - GLfloat vertex[8][3] = | |
9 | - {{-1.0, -1.0, 1.0}, {-1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, | |
10 | - {-1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, -1.0, -1.0}, | |
11 | - {1.0, 1.0, -1.0}, {1.0, 1.0, 1.0}}; | |
12 | - | |
13 | - | |
14 | - | |
15 | -void | |
16 | -renderScene(void) | |
17 | - { | |
18 | - glEnable(GL_TEXTURE_3D); | |
19 | - glBindTexture(GL_TEXTURE_3D, texId); | |
20 | - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | |
21 | - glLoadIdentity(); | |
22 | - //glTranslate(0.0, -1.0, -2.4); | |
23 | - glBegin(GL_QUADS); | |
24 | - for (int i = 0; i < 6; i++) { | |
25 | - //first vertex | |
26 | - glTexCoord3d(vertex[faces[i][0]][0], | |
27 | - vertex[faces[i][0]][1], | |
28 | - vertex[faces[i][0]][2]); | |
29 | - | |
30 | - glVertex3d(vertex[faces[i][0]][0], | |
31 | - vertex[faces[i][0]][1], | |
32 | - vertex[faces[i][0]][2]); | |
33 | - | |
34 | - //second vertex | |
35 | - glTexCoord3d(vertex[faces[i][1]][0], | |
36 | - vertex[faces[i][1]][1], | |
37 | - vertex[faces[i][1]][2]); | |
38 | - | |
39 | - glVertex3d(vertex[faces[i][1]][0], | |
40 | - vertex[faces[i][1]][1], | |
41 | - vertex[faces[i][1]][2]); | |
42 | - | |
43 | - //third vertex | |
44 | - glTexCoord3d(vertex[faces[i][2]][0], | |
45 | - vertex[faces[i][2]][1], | |
46 | - vertex[faces[i][2]][2]); | |
47 | - | |
48 | - glVertex3d(vertex[faces[i][2]][0], | |
49 | - vertex[faces[i][2]][1], | |
50 | - vertex[faces[i][2]][2]); | |
51 | - | |
52 | - //fourth vertex | |
53 | - glTexCoord3d(vertex[faces[i][3]][0], | |
54 | - vertex[faces[i][3]][1], | |
55 | - vertex[faces[i][3]][2]); | |
56 | - | |
57 | - glVertex3d(vertex[faces[i][3]][0], | |
58 | - vertex[faces[i][3]][1], | |
59 | - vertex[faces[i][3]][2]); | |
60 | - } | |
61 | - glEnd(); | |
62 | - | |
63 | - glutSwapBuffers(); | |
64 | - } | |
65 | - | |
66 | -} | |
67 | - | |
68 | -void | |
69 | -processKeys(unsigned char key, int x, int y) | |
70 | -{ | |
71 | - if (key == 27) | |
72 | - exit(0); | |
73 | -} | |
74 | - | |
75 | - | |
76 | -void | |
77 | -changeSize(int w, int h) | |
78 | -{ | |
79 | - if (h==0) | |
80 | - h=1; | |
81 | - float ratio = w*1.0/h; | |
82 | - glMatrixMode(GL_PROJECTION); | |
83 | - | |
84 | - glLoadIdentity(); | |
85 | - | |
86 | - glViewport(0,0,w,h); | |
87 | - | |
88 | - gluPerspective(45.0, ratio, 0.1, 100.0); | |
89 | - | |
90 | - glMatrixMode(GL_MODELVIEW); | |
91 | -} | |
92 | - | |
93 | -GLuint _texID; | |
94 | - | |
95 | -int | |
96 | -main(int argc, char **argv) | |
97 | -{ | |
98 | - stim::texture<unsigned char> stack("/home/pavel/Documents/Test_Data/"); | |
99 | - stim::texture.CreateTexture(); | |
100 | - glutInit(&argc, argv); | |
101 | - glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); | |
102 | - glutInitWindowSize(720, 720); | |
103 | - glutCreateWindow("gl_textures"); | |
104 | - std::cerr << " Initialization is complete in Glut" << std::endl; | |
105 | - | |
106 | - //Process keyboard commands (exit on esc) | |
107 | - glutKeyboardFunc(&processKeys); | |
108 | - glutReshapeFunc(&changeSize); | |
109 | - glutDisplayFunc(&renderScene); | |
110 | - std::cerr << " Keyboard and Reshape is complete in Glut" << std::endl; | |
111 | - | |
112 | - //Render Scene and such. | |
113 | - std::cerr << " Loaded Image " << std::endl; | |
114 | - glutMainLoop(); | |
115 | - return 0; | |
116 | - | |
117 | -} |