Commit f7d360df16d141c3510a262f6b6c22c075d2b739
1 parent
691fa079
resoloved conflicts
Showing
1 changed file
with
37 additions
and
16 deletions
Show diff stats
main.cu
@@ -122,19 +122,38 @@ void glut_render_modelview(){ | @@ -122,19 +122,38 @@ void glut_render_modelview(){ | ||
122 | //draws the network(s) | 122 | //draws the network(s) |
123 | void glut_render(void) { | 123 | void glut_render(void) { |
124 | 124 | ||
125 | - if(num_nets == 1){ //if a single network is loaded | ||
126 | - glut_render_single_projection(); //fill the entire viewport | ||
127 | - glut_render_modelview(); //set up the modelview matrix with camera details | ||
128 | - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //clear the screen | ||
129 | - GT.glCenterline(); //render the GT network (the only one loaded) | 125 | + if (ind == 0) { |
126 | + if (num_nets == 1) { //if a single network is loaded | ||
127 | + glut_render_single_projection(); //fill the entire viewport | ||
128 | + glut_render_modelview(); //set up the modelview matrix with camera details | ||
129 | + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //clear the screen | ||
130 | + GT.glCenterline0(); //render the GT network (the only one loaded) | ||
131 | + } | ||
132 | + | ||
133 | + if (num_nets == 2) { //if two networks are loaded | ||
134 | + | ||
135 | + glut_render_left_projection(); //set up a projection for the left half of the window | ||
136 | + glut_render_modelview(); //set up the modelview matrix using camera details | ||
137 | + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //clear the screen | ||
138 | + | ||
139 | + glEnable(GL_TEXTURE_1D); //enable texture mapping | ||
140 | + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); //texture map will be used as the network color | ||
141 | + glBindTexture(GL_TEXTURE_1D, cmap_tex); //bind the Brewer texture map | ||
142 | + | ||
143 | + GT.glCenterline(); //render the GT network | ||
144 | + | ||
145 | + glut_render_right_projection(); //set up a projection for the right half of the window | ||
146 | + glut_render_modelview(); //set up the modelview matrix using camera details | ||
147 | + T.glCenterline(); //render the T network | ||
148 | + } | ||
130 | } | 149 | } |
131 | - else{ | ||
132 | - if(num_nets == 1){ //if a single network is loaded | 150 | + else { |
151 | + if (num_nets == 1) { //if a single network is loaded | ||
133 | std::cout << "You should have at least two networks to do mapping." << std::endl; //exit program because there isn't enough network | 152 | std::cout << "You should have at least two networks to do mapping." << std::endl; //exit program because there isn't enough network |
134 | exit(1); | 153 | exit(1); |
135 | } | 154 | } |
136 | - if(num_nets == 2){ //if two networks are loaded | ||
137 | - if(compareMode){ | 155 | + if (num_nets == 2) { //if two networks are loaded |
156 | + if (compareMode) { | ||
138 | glut_render_left_projection(); //set up a projection for the left half of the window | 157 | glut_render_left_projection(); //set up a projection for the left half of the window |
139 | glut_render_modelview(); //set up the modelview matrix using camera details | 158 | glut_render_modelview(); //set up the modelview matrix using camera details |
140 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //clear the screen | 159 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //clear the screen |
@@ -149,11 +168,13 @@ void glut_render(void) { | @@ -149,11 +168,13 @@ void glut_render(void) { | ||
149 | glut_render_modelview(); //set up the modelview matrix using camera details | 168 | glut_render_modelview(); //set up the modelview matrix using camera details |
150 | _T.glCenterline(); //render the T network | 169 | _T.glCenterline(); //render the T network |
151 | 170 | ||
152 | - GT.glCenterline(); //render the GT network | 171 | + } |
172 | + else { | ||
173 | + glut_render_left_projection(); //set up a projection for the left half of the window | ||
174 | + glut_render_modelview(); //set up the modelview matrix using camera details | ||
175 | + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //clear the screen | ||
153 | 176 | ||
154 | - glut_render_right_projection(); //set up a projection for the right half of the window | ||
155 | - glut_render_modelview(); //set up the modelview matrix using camera details | ||
156 | - T.glCenterline(); //render the T network | 177 | + _GT.glRandColorCenterlineGT(dlist1, _gt_t, colormap); |
157 | 178 | ||
158 | glut_render_right_projection(); //set up a projection for the right half of the window | 179 | glut_render_right_projection(); //set up a projection for the right half of the window |
159 | glut_render_modelview(); //set up the modelview matrix using camera details | 180 | glut_render_modelview(); //set up the modelview matrix using camera details |
@@ -162,7 +183,7 @@ void glut_render(void) { | @@ -162,7 +183,7 @@ void glut_render(void) { | ||
162 | } | 183 | } |
163 | } | 184 | } |
164 | 185 | ||
165 | - if(num_nets == 2){ | 186 | + if (num_nets == 2) { |
166 | std::ostringstream ss; | 187 | std::ostringstream ss; |
167 | if (mappingMode) // if it is in mapping mode | 188 | if (mappingMode) // if it is in mapping mode |
168 | ss << "Mapping Mode"; | 189 | ss << "Mapping Mode"; |
@@ -183,8 +204,8 @@ void glut_render(void) { | @@ -183,8 +204,8 @@ void glut_render(void) { | ||
183 | glPushMatrix(); | 204 | glPushMatrix(); |
184 | glLoadIdentity(); | 205 | glLoadIdentity(); |
185 | 206 | ||
186 | - glRasterPos2f(0, 5); //print text in the bottom left corner | ||
187 | - glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)(ss.str().c_str())); | 207 | + glRasterPos2f(0, 5); //print text in the bottom left corner |
208 | + glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)(ss.str().c_str())); | ||
188 | 209 | ||
189 | glPopMatrix(); | 210 | glPopMatrix(); |
190 | glMatrixMode(GL_PROJECTION); | 211 | glMatrixMode(GL_PROJECTION); |