From f6d25eb452f60ab0f0f655e1042422830cc33384 Mon Sep 17 00:00:00 2001 From: Pavel Govyadinov Date: Fri, 10 Apr 2015 19:48:20 -0500 Subject: [PATCH] first spider implementation, currently just generates the spider --- TextureTest.cu | 60 ++++++++++++++---------------------------------------------- stim | 2 +- 2 files changed, 15 insertions(+), 47 deletions(-) diff --git a/TextureTest.cu b/TextureTest.cu index 61da5a1..5b5115b 100644 --- a/TextureTest.cu +++ b/TextureTest.cu @@ -6,6 +6,7 @@ #include //#include //#include +#include "stim/gl/gl_spider.h" #include "stim/gl/gl_texture.h" #include "stim/gl/error.h" #include "stim/visualization/camera.h" @@ -48,6 +49,7 @@ ,adjustDrw/2 ,adjustDrw/2}; static GLfloat org[2] = {adjustTex/2,adjustTex/2+425*adjustTex}; + stim::gl_spider spidey; //init for a cube void glInit() @@ -213,48 +215,32 @@ DrawSpiders() ); glVertex2f(-5.0, -3.0); glEnd(); - /*glBegin(GL_QUADS); + glBegin(GL_QUADS); glTexCoord3f( vertexTex[3][0], oriTex[1], vertexTex[3][2] ); - glVertex3f( - vertexDrw[3][0], - oriDrw[1], - vertexDrw[3][2] - ); + glVertex2f(-5.0, -2.9); glTexCoord3f( vertexTex[2][0], oriTex[1], vertexTex[2][2] ); - glVertex3f( - vertexDrw[2][0], - oriDrw[1], - vertexDrw[2][2] - ); + glVertex2f(-3.0, -2.9); glTexCoord3f( vertexTex[7][0], oriTex[1], vertexTex[7][2] ); - glVertex3f( - vertexDrw[7][0], - oriDrw[1], - vertexDrw[7][2] - ); + glVertex2f(-3.0, -0.9); glTexCoord3f( vertexTex[6][0], oriTex[1], vertexTex[6][2] ); - glVertex3f( - vertexDrw[6][0], - oriDrw[1], - vertexDrw[6][2] - ); - glEnd();*/ + glVertex2f(-5.0, -0.9); + glEnd(); } @@ -263,29 +249,16 @@ DrawSpiders() void renderScene() { -/* glInitNames(); - glEnable(GL_TEXTURE_3D); - glBindTexture(GL_TEXTURE_3D, texID); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glMatrixMode(GL_MODELVIEW); + glViewport(0, 0, size[0], size[1]); + glMatrixMode(GL_PROJECTION); glLoadIdentity(); - p = cam.getPosition(); - up = cam.getUp(); - d = cam.getLookAt(); - gluLookAt(p[0], p[1], p[2], d[0], d[1], d[2], up[0], up[1], up[2]); - DrawPlanes(); - glDisable(GL_TEXTURE_3D); - DrawCube(); -*/ + glOrtho(-5.0, 2.0,-5.0, 2.0, -0.0, 1000.0); + glMatrixMode(GL_MODELVIEW); -//Draw 3D elements glInitNames(); glEnable(GL_TEXTURE_3D); glBindTexture(GL_TEXTURE_3D, texID); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glMatrixMode(GL_PROJECTION); - //glLoadIdentity(); - glOrtho(-5.0, 2.0,-5.0, 2.0, -0.0, 1000.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); p = cam.getPosition(); @@ -295,18 +268,13 @@ renderScene() DrawPlanes(); glDisable(GL_TEXTURE_3D); DrawCube(); - - -//Draw 2D elements glEnable(GL_TEXTURE_3D); glBindTexture(GL_TEXTURE_3D, texID); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); + glViewport(0,0, 800,800); gluOrtho2D(-5.0, 2.0,-5.0, 2.0); - glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); DrawSpiders(); glDisable(GL_TEXTURE_3D); -*/ glutSwapBuffers(); } diff --git a/stim b/stim index fb0bc2f..eeebe22 160000 --- a/stim +++ b/stim @@ -1 +1 @@ -Subproject commit fb0bc2f13a22ec3579c5d48970eec944e31b59bc +Subproject commit eeebe2234ddefea82c7205cba19e2cfebe5893b0 -- libgit2 0.21.4