Commit 705eef0dd2be43ee70110a1b2121d6227a926305
1 parent
21520d14
Small changes to projection and coordinate system as well as using the camera cl…
…ass to rotate the view (not finished but works in current state without any rotation
Showing
2 changed files
with
211 additions
and
165 deletions
Show diff stats
TextureTest.cu
1 | 1 | #include <math.h> |
2 | 2 | #include <iostream> |
3 | 3 | #include <vector> |
4 | +#include "stim/math/vector.h" | |
4 | 5 | //#include <GL/glew.h> |
5 | 6 | #include <GL/glut.h> |
6 | 7 | //#include <GL/glext.h> |
7 | 8 | #include "stim/gl/gl_texture.h" |
8 | 9 | #include "stim/gl/error.h" |
9 | - GLuint texID; | |
10 | +#include "stim/visualization/camera.h" | |
10 | 11 | |
12 | + stim::camera cam; | |
13 | + GLuint texID; | |
14 | + GLsizei size[2] = {900,900}; | |
11 | 15 | GLfloat Normals[6][3] = |
12 | 16 | {{ -1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {1.0, 0.0, 0.0}, |
13 | 17 | {0.0, -1.0, 0.0}, {0.0, 0.0, 1.0}, {0.0, 0.0, -1.0}}; |
14 | - //GLint faces[6][4] = | |
15 | - // {{0, 1, 2, 3}, {3, 2, 6, 7}, {7, 6, 5, 4}, | |
16 | - // {4, 5, 1, 0}, {5, 6, 2, 1}, {7, 4, 0, 3}}; | |
17 | - //GLfloat vertex[8][3] = | |
18 | - // {{0.0, 0.0, 1.0}, {0.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, | |
19 | - // {0.0, 1.0, 1.0}, {1.0, 0.0, 1.0}, {1.0, 0.0, 0.0}, | |
20 | - // {1.0, 1.0, 0.0}, {1.0, 1.0, 1.0}}; | |
21 | - //GLfloat vertex[8][3] = | |
22 | - // {{-1.0, -1.0, 1.0}, {-1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, | |
23 | - // {-1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, -1.0, -1.0}, | |
24 | - // {1.0, 1.0, -1.0}, {1.0, 1.0, 1.0}}; | |
25 | 18 | GLint faces[6][4] = |
26 | 19 | {{0, 1, 2, 3}, {4, 5, 7, 6}, {1, 5, 7, 2}, |
27 | 20 | {3, 2, 7, 6}, {0, 4, 6, 3}, {0, 1, 5, 4}}; |
28 | - GLfloat vertex[8][3] = | |
21 | + GLfloat vertexTex[8][3] = | |
29 | 22 | {{0.0, 0.0, 1.0}, {1.0, 0.0, 1.0}, {1.0, 1.0, 1.0}, |
30 | 23 | {0.0, 1.0, 1.0}, {0.0, 0.0, 0.0}, {1.0, 0.0, 0.0}, |
31 | 24 | {0.0, 1.0, 0.0}, {1.0, 1.0, 0.0}}; |
32 | 25 | GLint lines[24] = {0,1,1,2,2,3,0,3,4,5,5,7,7,6,6,4,3,6,2,7,1,5,0,4}; |
33 | - /*GLfloat vertex[8][3] = | |
26 | + GLfloat vertexDrw[8][3] = | |
34 | 27 | {{-1.0, -1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, 1.0}, |
35 | 28 | {-1.0, 1.0, 1.0}, {-1.0, -1.0, -1.0}, {1.0, -1.0, -1.0}, |
36 | - {1.0, 1.0, -1.0}, {-1.0, 1.0, -1.0}}; */ | |
37 | - | |
29 | + {-1.0, 1.0, -1.0}, {1.0, 1.0, -1.0}}; | |
30 | + //static float mousePos[2]; | |
38 | 31 | unsigned long tick = 0; |
32 | + stim::vec<float> p; | |
33 | + stim::vec<float> up; | |
34 | + stim::vec<float> d; | |
39 | 35 | static bool button1 = FALSE; |
40 | 36 | //static GLfloat viewDistance = 1.0; |
41 | - static float pos = 1.6; | |
42 | - static GLfloat adjust = 1.0/426.0; | |
43 | - static GLfloat ori[3] = {adjust/2,adjust/2,adjust/2}; | |
44 | - static GLfloat org[2] = {adjust/2,adjust/2+425*adjust}; | |
37 | + //static float pos = 1.0; | |
38 | + static GLfloat adjustTex = 1.0/426.0; | |
39 | + static GLfloat adjustDrw = 2.0/426.0; | |
40 | + static GLfloat oriTex[3] = {adjustTex*213+adjustTex/2 | |
41 | + ,adjustTex*213+adjustTex/2 | |
42 | + ,adjustTex*213+adjustTex/2}; | |
43 | + static GLfloat oriDrw[3] = {adjustDrw/2 | |
44 | + ,adjustDrw/2 | |
45 | + ,adjustDrw/2}; | |
46 | + static GLfloat org[2] = {adjustTex/2,adjustTex/2+425*adjustTex}; | |
47 | + | |
45 | 48 | //init for a cube |
46 | 49 | void |
47 | 50 | glInit(int w, int h) |
... | ... | @@ -53,84 +56,25 @@ glInit(int w, int h) |
53 | 56 | glClearColor(0.0, 0.0, 0.0, 0.0); |
54 | 57 | glColor4d(0.0, 0.0, 0.0, 1.0); |
55 | 58 | glShadeModel(GL_FLAT); |
56 | - | |
57 | - glViewport(0, 0, (GLsizei) 1024, (GLsizei) 1024); | |
59 | + cam.setPosition(3.0,3.0,3.0); | |
60 | + cam.setFocalDistance(6.0); | |
61 | + //cam.setFOV(60.0); | |
62 | + cam.LookAt(0.0, 0.0, 0.0); | |
63 | + //cam.OrbitFocus(30.0, 30.0); | |
64 | + p = cam.getPosition(); | |
65 | + up = cam.getUp(); | |
66 | + //d = cam.getDirection(); | |
67 | + d = cam.getLookAt(); | |
68 | + //gluLookAt(d[0], d[1], d[2], p[0], p[1], p[2], up[0], up[1], up[2]); | |
69 | + glViewport(0, 0, size[0], size[1]); | |
58 | 70 | glMatrixMode(GL_PROJECTION); |
59 | 71 | glLoadIdentity(); |
60 | - gluPerspective(90, 4.0/3.0, 0.1, 100.0); | |
72 | + //gluPerspective(60, 4.0/3.0, 0.1, 100.0); | |
73 | + //glOrtho(-2.0, 2.0,-2.0, 2.0, -0.0, 3000.0); | |
61 | 74 | glMatrixMode(GL_MODELVIEW); |
62 | 75 | |
63 | 76 | CHECK_OPENGL_ERROR |
64 | 77 | } |
65 | -//init for a square. | |
66 | -void | |
67 | -glInitSquare(int w, int h) | |
68 | -{ | |
69 | - glEnable(GL_TEXTURE_3D); | |
70 | - glEnable(GL_DEPTH_TEST); | |
71 | - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); | |
72 | - glClearColor(0.0, 0.0, 0.0, 0.0); | |
73 | - glColor4d(0.0, 0.0, 0.0, 1.0); | |
74 | - //glPointSize(3.0); | |
75 | - glShadeModel(GL_FLAT); | |
76 | - | |
77 | - glViewport(0, 0, (GLsizei) 1024, (GLsizei) 1024); | |
78 | - glMatrixMode(GL_PROJECTION); | |
79 | - glLoadIdentity(); | |
80 | - gluPerspective(90, 4.0/3.0, 0.1, 100.0); | |
81 | - glMatrixMode(GL_MODELVIEW); | |
82 | - | |
83 | -} | |
84 | -//render square | |
85 | -void | |
86 | -renderSceneSquare() | |
87 | -{ | |
88 | - glEnable(GL_TEXTURE_3D); | |
89 | - glBindTexture(GL_TEXTURE_3D, texID); | |
90 | - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | |
91 | - glMatrixMode(GL_MODELVIEW); | |
92 | - glLoadIdentity(); | |
93 | - glTranslatef(-0.5, -0.5, -pos); | |
94 | - glBegin(GL_QUADS); | |
95 | - glTexCoord3f(vertex[faces[1][0]][0], | |
96 | - vertex[faces[1][0]][1], | |
97 | - ori[2]); | |
98 | - | |
99 | - glVertex3f(vertex[faces[1][0]][0], | |
100 | - vertex[faces[1][0]][1], | |
101 | - vertex[faces[1][0]][2]); | |
102 | - | |
103 | - //second vertex | |
104 | - glTexCoord3f(vertex[faces[1][1]][0], | |
105 | - vertex[faces[1][1]][1], | |
106 | - ori[2]); | |
107 | - | |
108 | - glVertex3f(vertex[faces[1][1]][0], | |
109 | - vertex[faces[1][1]][1], | |
110 | - vertex[faces[1][1]][2]); | |
111 | - | |
112 | - //third vertex | |
113 | - glTexCoord3f(vertex[faces[1][2]][0], | |
114 | - vertex[faces[1][2]][1], | |
115 | - ori[2]); | |
116 | - | |
117 | - glVertex3f(vertex[faces[1][2]][0], | |
118 | - vertex[faces[1][2]][1], | |
119 | - vertex[faces[1][2]][2]); | |
120 | - | |
121 | - //fourth vertex | |
122 | - glTexCoord3f(vertex[faces[1][3]][0], | |
123 | - vertex[faces[1][3]][1], | |
124 | - ori[2]); | |
125 | - | |
126 | - glVertex3f(vertex[faces[1][3]][0], | |
127 | - vertex[faces[1][3]][1], | |
128 | - vertex[faces[1][3]][2]); | |
129 | - glEnd(); | |
130 | - | |
131 | - CHECK_OPENGL_ERROR | |
132 | - glutSwapBuffers(); | |
133 | -} | |
134 | 78 | |
135 | 79 | |
136 | 80 | |
... | ... | @@ -145,93 +89,102 @@ renderScene() |
145 | 89 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
146 | 90 | glMatrixMode(GL_MODELVIEW); |
147 | 91 | glLoadIdentity(); |
148 | - glTranslatef(-0.5, -0.5, -pos); | |
149 | - glRotatef(-90, 1.0, 0.0, 0.0); | |
150 | - glRotatef((float)tick/100.0, 1.0, 1.0, 1.0); | |
92 | + //glTranslatef(-0.5, -0.5, -pos); | |
93 | + gluLookAt(p[0], p[1], p[2], d[0], d[1], d[2], up[0], up[1], up[2]); | |
94 | + //cam.OrbitFocus(30.0, 30.0); | |
95 | + //p = cam.getPosition(); | |
96 | + //up = cam.getUp(); | |
97 | + //d = cam.getDirection(); | |
98 | + //std::cout << "d:" << d << std::endl; | |
99 | + //std::cout << "p:" << p << std::endl; | |
100 | + //std::cout << "up:" <<up << std::endl; | |
101 | + //gluLookAt(d[0], d[1], d[2], p[0], p[1], p[2], up[0], up[1], up[2]); | |
102 | + //glRotatef(60.0, 1.0, 1.0, 1.0); | |
103 | + //glRotatef((float)tick/100.0, 1.0, 1.0, 1.0); | |
151 | 104 | CHECK_OPENGL_ERROR |
152 | 105 | |
153 | 106 | glBegin(GL_QUADS); |
154 | 107 | glTexCoord3f( |
155 | - vertex[0][0], | |
156 | - vertex[0][1], | |
157 | - ori[2] | |
108 | + vertexTex[0][0], | |
109 | + vertexTex[0][1], | |
110 | + oriTex[2] | |
158 | 111 | ); |
159 | 112 | glVertex3f( |
160 | - vertex[0][0], | |
161 | - vertex[0][1], | |
162 | - ori[2] | |
113 | + vertexDrw[0][0], | |
114 | + vertexDrw[0][1], | |
115 | + oriDrw[2] | |
163 | 116 | ); |
164 | 117 | glTexCoord3f( |
165 | - vertex[1][0], | |
166 | - vertex[1][1], | |
167 | - ori[2] | |
118 | + vertexTex[1][0], | |
119 | + vertexTex[1][1], | |
120 | + oriTex[2] | |
168 | 121 | ); |
169 | 122 | glVertex3f( |
170 | - vertex[1][0], | |
171 | - vertex[1][1], | |
172 | - ori[2] | |
123 | + vertexDrw[1][0], | |
124 | + vertexDrw[1][1], | |
125 | + oriDrw[2] | |
173 | 126 | ); |
174 | 127 | glTexCoord3f( |
175 | - vertex[2][0], | |
176 | - vertex[2][1], | |
177 | - ori[2] | |
128 | + vertexTex[2][0], | |
129 | + vertexTex[2][1], | |
130 | + oriTex[2] | |
178 | 131 | ); |
179 | 132 | glVertex3f( |
180 | - vertex[2][0], | |
181 | - vertex[2][1], | |
182 | - ori[2] | |
133 | + vertexDrw[2][0], | |
134 | + vertexDrw[2][1], | |
135 | + oriDrw[2] | |
183 | 136 | ); |
184 | 137 | glTexCoord3f( |
185 | - vertex[3][0], | |
186 | - vertex[3][1], | |
187 | - ori[2] | |
138 | + vertexTex[3][0], | |
139 | + vertexTex[3][1], | |
140 | + oriTex[2] | |
188 | 141 | ); |
189 | 142 | glVertex3f( |
190 | - vertex[3][0], | |
191 | - vertex[3][1], | |
192 | - ori[2] | |
143 | + vertexDrw[3][0], | |
144 | + vertexDrw[3][1], | |
145 | + oriDrw[2] | |
193 | 146 | ); |
194 | 147 | glEnd(); |
195 | 148 | glBegin(GL_QUADS); |
196 | 149 | glTexCoord3f( |
197 | - vertex[3][0], | |
198 | - ori[1], | |
199 | - vertex[3][2] | |
150 | + vertexTex[3][0], | |
151 | + oriTex[1], | |
152 | + vertexTex[3][2] | |
200 | 153 | ); |
201 | 154 | glVertex3f( |
202 | - vertex[3][0], | |
203 | - ori[1], | |
204 | - vertex[3][2] | |
155 | + vertexDrw[3][0], | |
156 | + oriDrw[1], | |
157 | + vertexDrw[3][2] | |
205 | 158 | ); |
206 | 159 | glTexCoord3f( |
207 | - vertex[2][0], | |
208 | - ori[1], | |
209 | - vertex[2][2] | |
160 | + vertexTex[2][0], | |
161 | + oriTex[1], | |
162 | + vertexTex[2][2] | |
210 | 163 | ); |
211 | 164 | glVertex3f( |
212 | - vertex[2][0], | |
213 | - ori[1], | |
214 | - vertex[2][2] | |
165 | + vertexDrw[2][0], | |
166 | + oriDrw[1], | |
167 | + vertexDrw[2][2] | |
215 | 168 | ); |
216 | 169 | glTexCoord3f( |
217 | - vertex[7][0], | |
218 | - ori[1], | |
219 | - vertex[7][2] | |
170 | + vertexTex[7][0], | |
171 | + oriTex[1], | |
172 | + vertexTex[7][2] | |
220 | 173 | ); |
221 | 174 | glVertex3f( |
222 | - vertex[7][0], | |
223 | - ori[1], | |
224 | - vertex[7][2] | |
175 | + vertexDrw[7][0], | |
176 | + oriDrw[1], | |
177 | + vertexDrw[7][2] | |
225 | 178 | ); |
226 | 179 | glTexCoord3f( |
227 | - vertex[6][0], | |
228 | - ori[1], | |
229 | - vertex[6][2] | |
180 | + vertexTex[6][0], | |
181 | + oriTex[1], | |
182 | + vertexTex[6][2] | |
230 | 183 | ); |
231 | 184 | glVertex3f( |
232 | - vertex[6][0], | |
233 | - ori[1], | |
234 | - vertex[6][2] | |
185 | + vertexDrw[6][0], | |
186 | + oriDrw[1], | |
187 | + vertexDrw[6][2] | |
235 | 188 | ); |
236 | 189 | glEnd(); |
237 | 190 | CHECK_OPENGL_ERROR |
... | ... | @@ -242,9 +195,9 @@ renderScene() |
242 | 195 | |
243 | 196 | for (int i = 0; i < 24; i++) |
244 | 197 | { |
245 | - glVertex3f(vertex[lines[i]][0], | |
246 | - vertex[lines[i]][1], | |
247 | - vertex[lines[i]][2]); | |
198 | + glVertex3f(vertexDrw[lines[i]][0], | |
199 | + vertexDrw[lines[i]][1], | |
200 | + vertexDrw[lines[i]][2]); | |
248 | 201 | } |
249 | 202 | glEnd(); |
250 | 203 | glutSwapBuffers(); |
... | ... | @@ -258,7 +211,7 @@ void MouseButton(int button, int state, int x, int y) |
258 | 211 | if (button == GLUT_LEFT_BUTTON) |
259 | 212 | { |
260 | 213 | button1 = (state == GLUT_DOWN) ? TRUE : FALSE; |
261 | - //prev_pos = y; | |
214 | + // mousePos = {float(x)/size[0], 1.0 - float(y)/size[1]}; | |
262 | 215 | } |
263 | 216 | } |
264 | 217 | |
... | ... | @@ -266,7 +219,7 @@ void MouseMotion(int x, int y) |
266 | 219 | { |
267 | 220 | if(button1) |
268 | 221 | { |
269 | - pos = (float)y/100.0; | |
222 | + //pos = (float)y/100.0; | |
270 | 223 | glutPostRedisplay(); |
271 | 224 | } |
272 | 225 | } |
... | ... | @@ -283,28 +236,40 @@ processSpecialKeys(int key, int xx, int yy) |
283 | 236 | { |
284 | 237 | switch(key) { |
285 | 238 | case GLUT_KEY_UP: |
286 | - ori[2] = ori[2]+adjust; | |
287 | - if (ori[2] > org[1]){ | |
288 | - ori[2] = org[1]; | |
289 | - } | |
239 | + oriTex[2] = oriTex[2]+adjustTex; | |
240 | + if (oriTex[2] > org[1]){ | |
241 | + oriTex[2] = org[1]; | |
242 | + } | |
243 | + else{ | |
244 | + oriDrw[2] = oriDrw[2] + adjustDrw; | |
245 | + } | |
290 | 246 | break; |
291 | 247 | case GLUT_KEY_DOWN: |
292 | - ori[2] = ori[2]-adjust; | |
293 | - if (ori[2] < org[0]){ | |
294 | - ori[2] = org[0]; | |
295 | - } | |
248 | + oriTex[2] = oriTex[2]-adjustTex; | |
249 | + if (oriTex[2] < org[0]){ | |
250 | + oriTex[2] = org[0]; | |
251 | + } | |
252 | + else{ | |
253 | + oriDrw[2] = oriDrw[2] - adjustDrw; | |
254 | + } | |
296 | 255 | break; |
297 | 256 | case GLUT_KEY_LEFT: |
298 | - ori[1] = ori[1]+adjust; | |
299 | - if (ori[1] > org[1]){ | |
300 | - ori[1] = org[1]; | |
257 | + oriTex[1] = oriTex[1]+adjustTex; | |
258 | + if (oriTex[1] > org[1]){ | |
259 | + oriTex[1] = org[1]; | |
301 | 260 | } |
261 | + else{ | |
262 | + oriDrw[1] = oriDrw[1] + adjustDrw; | |
263 | + } | |
302 | 264 | break; |
303 | 265 | case GLUT_KEY_RIGHT: |
304 | - ori[1] = ori[1]-adjust; | |
305 | - if (ori[1] < org[0]){ | |
306 | - ori[1] = org[0]; | |
266 | + oriTex[1] = oriTex[1]-adjustTex; | |
267 | + if (oriTex[1] < org[0]){ | |
268 | + oriTex[1] = org[0]; | |
307 | 269 | } |
270 | + else{ | |
271 | + oriDrw[1] = oriDrw[1] - adjustDrw; | |
272 | + } | |
308 | 273 | break; |
309 | 274 | } |
310 | 275 | } |
... | ... | @@ -324,7 +289,8 @@ changeSize(int w, int h) |
324 | 289 | glViewport(0,0,w,h); |
325 | 290 | glMatrixMode(GL_PROJECTION); |
326 | 291 | glLoadIdentity(); |
327 | - gluPerspective(90, 4.0/3.0, 0.1, 100.0); | |
292 | + glOrtho(-3.0, 3.0,-3.0, 3.0, -0.0, 1000.0); | |
293 | + //gluPerspective(90, 4.0/3.0, 0.1, 100.0); | |
328 | 294 | glMatrixMode(GL_MODELVIEW); |
329 | 295 | CHECK_OPENGL_ERROR |
330 | 296 | } |
... | ... | @@ -336,7 +302,7 @@ main(int argc, char **argv) |
336 | 302 | CHECK_OPENGL_ERROR |
337 | 303 | glutInit(&argc, argv); |
338 | 304 | glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); |
339 | - glutInitWindowSize(1024, 1024); | |
305 | + glutInitWindowSize(size[0], size[1]); | |
340 | 306 | glutCreateWindow("gl_texture"); |
341 | 307 | std::cout << " Initialization is complete in Glut" << std::endl; |
342 | 308 | |
... | ... | @@ -417,3 +383,83 @@ main(int argc, char **argv) |
417 | 383 | |
418 | 384 | }*/ |
419 | 385 | |
386 | +//init for a square. | |
387 | +/*void | |
388 | +glInitSquare(int w, int h) | |
389 | +{ | |
390 | + glEnable(GL_TEXTURE_3D); | |
391 | + glEnable(GL_DEPTH_TEST); | |
392 | + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); | |
393 | + glClearColor(0.0, 0.0, 0.0, 0.0); | |
394 | + glColor4d(0.0, 0.0, 0.0, 1.0); | |
395 | + //glPointSize(3.0); | |
396 | + glShadeModel(GL_FLAT); | |
397 | + | |
398 | + glViewport(0, 0, (GLsizei) 900, (GLsizei) 900); | |
399 | + glMatrixMode(GL_PROJECTION); | |
400 | + glLoadIdentity(); | |
401 | + gluPerspective(90, 4.0/3.0, 0.1, 100.0); | |
402 | + glMatrixMode(GL_MODELVIEW); | |
403 | + | |
404 | +} | |
405 | +//render square | |
406 | +void | |
407 | +renderSceneSquare() | |
408 | +{ | |
409 | + glEnable(GL_TEXTURE_3D); | |
410 | + glBindTexture(GL_TEXTURE_3D, texID); | |
411 | + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | |
412 | + glMatrixMode(GL_MODELVIEW); | |
413 | + glLoadIdentity(); | |
414 | + glTranslatef(-0.5, -0.5, -pos); | |
415 | + glBegin(GL_QUADS); | |
416 | + glTexCoord3f(vertexTex[faces[1][0]][0], | |
417 | + vertexTex[faces[1][0]][1], | |
418 | + oriTex[2]); | |
419 | + | |
420 | + glVertex3f(vertexDrw[faces[1][0]][0], | |
421 | + vertexDrw[faces[1][0]][1], | |
422 | + vertexDrw[faces[1][0]][2]); | |
423 | + | |
424 | + //second vertex | |
425 | + glTexCoord3f(vertexTex[faces[1][1]][0], | |
426 | + vertexTex[faces[1][1]][1], | |
427 | + oriTex[2]); | |
428 | + | |
429 | + glVertex3f(vertexDrw[faces[1][1]][0], | |
430 | + vertexDrw[faces[1][1]][1], | |
431 | + vertexDrw[faces[1][1]][2]); | |
432 | + | |
433 | + //third vertex | |
434 | + glTexCoord3f(vertexTex[faces[1][2]][0], | |
435 | + vertexTex[faces[1][2]][1], | |
436 | + oriTex[2]); | |
437 | + | |
438 | + glVertex3f(vertexDrw[faces[1][2]][0], | |
439 | + vertexDrw[faces[1][2]][1], | |
440 | + vertexDrw[faces[1][2]][2]); | |
441 | + | |
442 | + //fourth vertex | |
443 | + glTexCoord3f(vertexTex[faces[1][3]][0], | |
444 | + vertexTex[faces[1][3]][1], | |
445 | + oriTex[2]); | |
446 | + | |
447 | + glVertex3f(vertexDrw[faces[1][3]][0], | |
448 | + vertexDrw[faces[1][3]][1], | |
449 | + vertexDrw[faces[1][3]][2]); | |
450 | + glEnd(); | |
451 | + | |
452 | + CHECK_OPENGL_ERROR | |
453 | + glutSwapBuffers(); | |
454 | +}*/ | |
455 | + //GLint faces[6][4] = | |
456 | + // {{0, 1, 2, 3}, {3, 2, 6, 7}, {7, 6, 5, 4}, | |
457 | + // {4, 5, 1, 0}, {5, 6, 2, 1}, {7, 4, 0, 3}}; | |
458 | + //GLfloat vertex[8][3] = | |
459 | + // {{0.0, 0.0, 1.0}, {0.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, | |
460 | + // {0.0, 1.0, 1.0}, {1.0, 0.0, 1.0}, {1.0, 0.0, 0.0}, | |
461 | + // {1.0, 1.0, 0.0}, {1.0, 1.0, 1.0}}; | |
462 | + //GLfloat vertex[8][3] = | |
463 | + // {{-1.0, -1.0, 1.0}, {-1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, | |
464 | + // {-1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, -1.0, -1.0}, | |
465 | + // {1.0, 1.0, -1.0}, {1.0, 1.0, 1.0}}; | ... | ... |