Commit b06a4962fda938f245a20eeddc276699bca01765

Authored by Pavel Govyadinov
1 parent f6d25eb4

spider visualization implemented::Weird bug

Showing 2 changed files with 225 additions and 52 deletions   Show diff stats
TextureTest.cu
... ... @@ -50,6 +50,10 @@
50 50 ,adjustDrw/2};
51 51 static GLfloat org[2] = {adjustTex/2,adjustTex/2+425*adjustTex};
52 52 stim::gl_spider<float> spidey;
  53 + stim::vec<float>p1;
  54 + stim::vec<float>p2;
  55 + stim::vec<float>p3;
  56 + stim::vec<float>p4;
53 57 //init for a cube
54 58 void
55 59 glInit()
... ... @@ -72,7 +76,7 @@ glInit()
72 76 glLoadIdentity();
73 77 glOrtho(-5.0, 2.0,-5.0, 2.0, -0.0, 1000.0);
74 78 glMatrixMode(GL_MODELVIEW);
75   -
  79 + spidey = stim::gl_spider<float>(0.5, 0.5, 0.5, 0.1, 0.1, 0.1, 0.5, 0.5);
76 80 CHECK_OPENGL_ERROR
77 81 }
78 82  
... ... @@ -92,103 +96,111 @@ DrawCube()
92 96 }
93 97 glEnd();
94 98 }
95   -
  99 +
96 100 void
97 101 DrawPlanes()
98 102 {
  103 + p1 = spidey.ver.p(0,0);
  104 + p2 = spidey.ver.p(0,1);
  105 + p3 = spidey.ver.p(1,0);
  106 + p4 = spidey.ver.p(1,1);
99 107 glPushName(VERTICAL);
100 108 glBegin(GL_QUADS);
101 109 glTexCoord3f(
102   - vertexTex[0][0],
103   - vertexTex[0][1],
104   - oriTex[2]
  110 + p1[0],
  111 + p1[1],
  112 + p1[2]
105 113 );
106 114 glVertex3f(
107   - vertexDrw[0][0],
108   - vertexDrw[0][1],
109   - oriDrw[2]
  115 + p1[0],
  116 + p1[1],
  117 + p1[2]
110 118 );
111 119 glTexCoord3f(
112   - vertexTex[1][0],
113   - vertexTex[1][1],
114   - oriTex[2]
  120 + p2[0],
  121 + p2[1],
  122 + p2[2]
115 123 );
116 124 glVertex3f(
117   - vertexDrw[1][0],
118   - vertexDrw[1][1],
119   - oriDrw[2]
  125 + p2[0],
  126 + p2[1],
  127 + p2[2]
120 128 );
121 129 glTexCoord3f(
122   - vertexTex[2][0],
123   - vertexTex[2][1],
124   - oriTex[2]
  130 + p3[0],
  131 + p3[1],
  132 + p3[2]
125 133 );
126 134 glVertex3f(
127   - vertexDrw[2][0],
128   - vertexDrw[2][1],
129   - oriDrw[2]
  135 + p3[0],
  136 + p3[1],
  137 + p3[2]
130 138 );
131 139 glTexCoord3f(
132   - vertexTex[3][0],
133   - vertexTex[3][1],
134   - oriTex[2]
  140 + p4[0],
  141 + p4[1],
  142 + p4[2]
135 143 );
136 144 glVertex3f(
137   - vertexDrw[3][0],
138   - vertexDrw[3][1],
139   - oriDrw[2]
  145 + p4[0],
  146 + p4[1],
  147 + p4[2]
140 148 );
141 149 glEnd();
142 150 glPopName();
  151 + p1 = spidey.hor.p(0,0);
  152 + p2 = spidey.hor.p(0,1);
  153 + p3 = spidey.hor.p(1,0);
  154 + p4 = spidey.hor.p(1,1);
143 155 glPushName(HORIZONTAL);
144 156 glBegin(GL_QUADS);
145 157 glTexCoord3f(
146   - vertexTex[3][0],
147   - oriTex[1],
148   - vertexTex[3][2]
  158 + p1[0],
  159 + p1[1],
  160 + p1[2]
149 161 );
150 162 glVertex3f(
151   - vertexDrw[3][0],
152   - oriDrw[1],
153   - vertexDrw[3][2]
  163 + p1[0],
  164 + p1[1],
  165 + p1[2]
154 166 );
155 167 glTexCoord3f(
156   - vertexTex[2][0],
157   - oriTex[1],
158   - vertexTex[2][2]
  168 + p2[0],
  169 + p2[1],
  170 + p2[2]
159 171 );
160 172 glVertex3f(
161   - vertexDrw[2][0],
162   - oriDrw[1],
163   - vertexDrw[2][2]
  173 + p2[0],
  174 + p2[1],
  175 + p2[2]
164 176 );
165 177 glTexCoord3f(
166   - vertexTex[7][0],
167   - oriTex[1],
168   - vertexTex[7][2]
  178 + p3[0],
  179 + p3[1],
  180 + p3[2]
169 181 );
170 182 glVertex3f(
171   - vertexDrw[7][0],
172   - oriDrw[1],
173   - vertexDrw[7][2]
  183 + p3[0],
  184 + p3[1],
  185 + p3[2]
174 186 );
175 187 glTexCoord3f(
176   - vertexTex[6][0],
177   - oriTex[1],
178   - vertexTex[6][2]
  188 + p4[0],
  189 + p4[1],
  190 + p4[2]
179 191 );
180 192 glVertex3f(
181   - vertexDrw[6][0],
182   - oriDrw[1],
183   - vertexDrw[6][2]
  193 + p4[0],
  194 + p4[1],
  195 + p4[2]
184 196 );
185 197 glEnd();
186 198 glPopName();
187 199 }
188   -
189 200 void
190 201 DrawSpiders()
191 202 {
  203 + /*
192 204 glBegin(GL_QUADS);
193 205 glTexCoord3f(
194 206 vertexTex[0][0],
... ... @@ -241,6 +253,68 @@ DrawSpiders()
241 253 );
242 254 glVertex2f(-5.0, -0.9);
243 255 glEnd();
  256 + */
  257 + p1 = spidey.hor.p(0,0);
  258 + p2 = spidey.hor.p(0,1);
  259 + p3 = spidey.hor.p(1,0);
  260 + p4 = spidey.hor.p(1,1);
  261 + glBegin(GL_QUADS);
  262 + glTexCoord3f(
  263 + p1[0],
  264 + p1[1],
  265 + p1[2]
  266 + );
  267 + glVertex2f( -5.0,-5.0);
  268 + glTexCoord3f(
  269 + p2[0],
  270 + p2[1],
  271 + p2[2]
  272 + );
  273 + glVertex2f(-3.0, -5.0);
  274 + glTexCoord3f(
  275 + p3[0],
  276 + p3[1],
  277 + p3[2]
  278 + );
  279 + glVertex2f(-3.0, -3.0);
  280 + glTexCoord3f(
  281 + p4[0],
  282 + p4[1],
  283 + p4[2]
  284 + );
  285 + glVertex2f(-5.0, -3.0);
  286 + glEnd();
  287 + p1 = spidey.ver.p(0,0);
  288 + p2 = spidey.ver.p(0,1);
  289 + p3 = spidey.ver.p(1,0);
  290 + p4 = spidey.ver.p(1,1);
  291 +
  292 + glBegin(GL_QUADS);
  293 + glTexCoord3f(
  294 + p1[0],
  295 + p1[1],
  296 + p1[2]
  297 + );
  298 + glVertex2f(-5.0, -2.9);
  299 + glTexCoord3f(
  300 + p2[0],
  301 + p2[1],
  302 + p2[2]
  303 + );
  304 + glVertex2f(-3.0, -2.9);
  305 + glTexCoord3f(
  306 + p3[0],
  307 + p3[1],
  308 + p3[2]
  309 + );
  310 + glVertex2f(-3.0, -0.9);
  311 + glTexCoord3f(
  312 + p4[0],
  313 + p4[1],
  314 + p4[2]
  315 + );
  316 + glVertex2f(-5.0, -0.9);
  317 + glEnd();
244 318 }
245 319  
246 320  
... ... @@ -371,6 +445,11 @@ processKeys(unsigned char key, int x, int y)
371 445 {
372 446 if (key == 27)
373 447 exit(0);
  448 + if (key == 32)
  449 + {
  450 + spidey.Step();
  451 + std::cout << "Took a step" << std::endl;
  452 + }
374 453 }
375 454  
376 455  
... ... @@ -556,3 +635,97 @@ renderSceneSquare()
556 635 // {{-1.0, -1.0, 1.0}, {-1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0},
557 636 // {-1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, -1.0, -1.0},
558 637 // {1.0, 1.0, -1.0}, {1.0, 1.0, 1.0}};
  638 +/*
  639 +void
  640 +DrawPlanes()
  641 +{
  642 + glPushName(VERTICAL);
  643 + glBegin(GL_QUADS);
  644 + glTexCoord3f(
  645 + vertexTex[0][0],
  646 + vertexTex[0][1],
  647 + oriTex[2]
  648 + );
  649 + glVertex3f(
  650 + vertexDrw[0][0],
  651 + vertexDrw[0][1],
  652 + oriDrw[2]
  653 + );
  654 + glTexCoord3f(
  655 + vertexTex[1][0],
  656 + vertexTex[1][1],
  657 + oriTex[2]
  658 + );
  659 + glVertex3f(
  660 + vertexDrw[1][0],
  661 + vertexDrw[1][1],
  662 + oriDrw[2]
  663 + );
  664 + glTexCoord3f(
  665 + vertexTex[2][0],
  666 + vertexTex[2][1],
  667 + oriTex[2]
  668 + );
  669 + glVertex3f(
  670 + vertexDrw[2][0],
  671 + vertexDrw[2][1],
  672 + oriDrw[2]
  673 + );
  674 + glTexCoord3f(
  675 + vertexTex[3][0],
  676 + vertexTex[3][1],
  677 + oriTex[2]
  678 + );
  679 + glVertex3f(
  680 + vertexDrw[3][0],
  681 + vertexDrw[3][1],
  682 + oriDrw[2]
  683 + );
  684 + glEnd();
  685 + glPopName();
  686 + glPushName(HORIZONTAL);
  687 + glBegin(GL_QUADS);
  688 + glTexCoord3f(
  689 + vertexTex[3][0],
  690 + oriTex[1],
  691 + vertexTex[3][2]
  692 + );
  693 + glVertex3f(
  694 + vertexDrw[3][0],
  695 + oriDrw[1],
  696 + vertexDrw[3][2]
  697 + );
  698 + glTexCoord3f(
  699 + vertexTex[2][0],
  700 + oriTex[1],
  701 + vertexTex[2][2]
  702 + );
  703 + glVertex3f(
  704 + vertexDrw[2][0],
  705 + oriDrw[1],
  706 + vertexDrw[2][2]
  707 + );
  708 + glTexCoord3f(
  709 + vertexTex[7][0],
  710 + oriTex[1],
  711 + vertexTex[7][2]
  712 + );
  713 + glVertex3f(
  714 + vertexDrw[7][0],
  715 + oriDrw[1],
  716 + vertexDrw[7][2]
  717 + );
  718 + glTexCoord3f(
  719 + vertexTex[6][0],
  720 + oriTex[1],
  721 + vertexTex[6][2]
  722 + );
  723 + glVertex3f(
  724 + vertexDrw[6][0],
  725 + oriDrw[1],
  726 + vertexDrw[6][2]
  727 + );
  728 + glEnd();
  729 + glPopName();
  730 +}
  731 +*/
... ...
1   -Subproject commit eeebe2234ddefea82c7205cba19e2cfebe5893b0
  1 +Subproject commit 4cefeb6db2ba2fe11b6a921ef30b3ac87b8ab1ff
... ...