Commit f6d25eb452f60ab0f0f655e1042422830cc33384
1 parent
45dcc46b
first spider implementation, currently just generates the spider
Showing
2 changed files
with
15 additions
and
47 deletions
Show diff stats
TextureTest.cu
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | #include <GL/glut.h> |
7 | 7 | //#include <GL/gl.h> |
8 | 8 | //#include <GL/glext.h> |
9 | +#include "stim/gl/gl_spider.h" | |
9 | 10 | #include "stim/gl/gl_texture.h" |
10 | 11 | #include "stim/gl/error.h" |
11 | 12 | #include "stim/visualization/camera.h" |
... | ... | @@ -48,6 +49,7 @@ |
48 | 49 | ,adjustDrw/2 |
49 | 50 | ,adjustDrw/2}; |
50 | 51 | static GLfloat org[2] = {adjustTex/2,adjustTex/2+425*adjustTex}; |
52 | + stim::gl_spider<float> spidey; | |
51 | 53 | //init for a cube |
52 | 54 | void |
53 | 55 | glInit() |
... | ... | @@ -213,48 +215,32 @@ DrawSpiders() |
213 | 215 | ); |
214 | 216 | glVertex2f(-5.0, -3.0); |
215 | 217 | glEnd(); |
216 | - /*glBegin(GL_QUADS); | |
218 | + glBegin(GL_QUADS); | |
217 | 219 | glTexCoord3f( |
218 | 220 | vertexTex[3][0], |
219 | 221 | oriTex[1], |
220 | 222 | vertexTex[3][2] |
221 | 223 | ); |
222 | - glVertex3f( | |
223 | - vertexDrw[3][0], | |
224 | - oriDrw[1], | |
225 | - vertexDrw[3][2] | |
226 | - ); | |
224 | + glVertex2f(-5.0, -2.9); | |
227 | 225 | glTexCoord3f( |
228 | 226 | vertexTex[2][0], |
229 | 227 | oriTex[1], |
230 | 228 | vertexTex[2][2] |
231 | 229 | ); |
232 | - glVertex3f( | |
233 | - vertexDrw[2][0], | |
234 | - oriDrw[1], | |
235 | - vertexDrw[2][2] | |
236 | - ); | |
230 | + glVertex2f(-3.0, -2.9); | |
237 | 231 | glTexCoord3f( |
238 | 232 | vertexTex[7][0], |
239 | 233 | oriTex[1], |
240 | 234 | vertexTex[7][2] |
241 | 235 | ); |
242 | - glVertex3f( | |
243 | - vertexDrw[7][0], | |
244 | - oriDrw[1], | |
245 | - vertexDrw[7][2] | |
246 | - ); | |
236 | + glVertex2f(-3.0, -0.9); | |
247 | 237 | glTexCoord3f( |
248 | 238 | vertexTex[6][0], |
249 | 239 | oriTex[1], |
250 | 240 | vertexTex[6][2] |
251 | 241 | ); |
252 | - glVertex3f( | |
253 | - vertexDrw[6][0], | |
254 | - oriDrw[1], | |
255 | - vertexDrw[6][2] | |
256 | - ); | |
257 | - glEnd();*/ | |
242 | + glVertex2f(-5.0, -0.9); | |
243 | + glEnd(); | |
258 | 244 | } |
259 | 245 | |
260 | 246 | |
... | ... | @@ -263,29 +249,16 @@ DrawSpiders() |
263 | 249 | void |
264 | 250 | renderScene() |
265 | 251 | { |
266 | -/* glInitNames(); | |
267 | - glEnable(GL_TEXTURE_3D); | |
268 | - glBindTexture(GL_TEXTURE_3D, texID); | |
269 | - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | |
270 | - glMatrixMode(GL_MODELVIEW); | |
252 | + glViewport(0, 0, size[0], size[1]); | |
253 | + glMatrixMode(GL_PROJECTION); | |
271 | 254 | glLoadIdentity(); |
272 | - p = cam.getPosition(); | |
273 | - up = cam.getUp(); | |
274 | - d = cam.getLookAt(); | |
275 | - gluLookAt(p[0], p[1], p[2], d[0], d[1], d[2], up[0], up[1], up[2]); | |
276 | - DrawPlanes(); | |
277 | - glDisable(GL_TEXTURE_3D); | |
278 | - DrawCube(); | |
279 | -*/ | |
255 | + glOrtho(-5.0, 2.0,-5.0, 2.0, -0.0, 1000.0); | |
256 | + glMatrixMode(GL_MODELVIEW); | |
280 | 257 | |
281 | -//Draw 3D elements | |
282 | 258 | glInitNames(); |
283 | 259 | glEnable(GL_TEXTURE_3D); |
284 | 260 | glBindTexture(GL_TEXTURE_3D, texID); |
285 | 261 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
286 | - glMatrixMode(GL_PROJECTION); | |
287 | - //glLoadIdentity(); | |
288 | - glOrtho(-5.0, 2.0,-5.0, 2.0, -0.0, 1000.0); | |
289 | 262 | glMatrixMode(GL_MODELVIEW); |
290 | 263 | glLoadIdentity(); |
291 | 264 | p = cam.getPosition(); |
... | ... | @@ -295,18 +268,13 @@ renderScene() |
295 | 268 | DrawPlanes(); |
296 | 269 | glDisable(GL_TEXTURE_3D); |
297 | 270 | DrawCube(); |
298 | - | |
299 | - | |
300 | -//Draw 2D elements | |
301 | 271 | glEnable(GL_TEXTURE_3D); |
302 | 272 | glBindTexture(GL_TEXTURE_3D, texID); |
303 | - glMatrixMode(GL_PROJECTION); | |
304 | - glLoadIdentity(); | |
273 | + glViewport(0,0, 800,800); | |
305 | 274 | gluOrtho2D(-5.0, 2.0,-5.0, 2.0); |
306 | - glMatrixMode(GL_MODELVIEW); | |
275 | + glLoadIdentity(); | |
307 | 276 | DrawSpiders(); |
308 | 277 | glDisable(GL_TEXTURE_3D); |
309 | -*/ | |
310 | 278 | |
311 | 279 | glutSwapBuffers(); |
312 | 280 | } | ... | ... |