Commit 7728132061a8d83eb91c2904effc05aeff23273f
1 parent
c73ccf64
fixed cylinder texture mapping
Showing
1 changed file
with
5 additions
and
4 deletions
Show diff stats
stim/visualization/gl_network.h
@@ -112,9 +112,9 @@ public: | @@ -112,9 +112,9 @@ public: | ||
112 | 112 | ||
113 | if (radius != sigma) // if render radius was changed by user, create a new display list | 113 | if (radius != sigma) // if render radius was changed by user, create a new display list |
114 | glDeleteLists(dlist, 1); | 114 | glDeleteLists(dlist, 1); |
115 | - if (!glIsList(dlist)) { // if dlist isn't a display list, create it | ||
116 | - dlist = glGenLists(1); // generate a display list | ||
117 | - glNewList(dlist, GL_COMPILE); // start a new display list | 115 | + if (!glIsList(dlist)) { // if dlist isn't a display list, create it |
116 | + dlist = glGenLists(1); // generate a display list | ||
117 | + glNewList(dlist, GL_COMPILE); // start a new display list | ||
118 | for (unsigned e = 0; e < E.size(); e++) { // for each edge in the network | 118 | for (unsigned e = 0; e < E.size(); e++) { // for each edge in the network |
119 | for (unsigned p = 1; p < E[e].size(); p++) { // for each point on that edge | 119 | for (unsigned p = 1; p < E[e].size(); p++) { // for each point on that edge |
120 | stim::circle<T> C1 = E[e].circ(p - 1); | 120 | stim::circle<T> C1 = E[e].circ(p - 1); |
@@ -125,9 +125,10 @@ public: | @@ -125,9 +125,10 @@ public: | ||
125 | std::vector< stim::vec3<T> >Cp2 = C2.glpoints(20); | 125 | std::vector< stim::vec3<T> >Cp2 = C2.glpoints(20); |
126 | glBegin(GL_QUAD_STRIP); | 126 | glBegin(GL_QUAD_STRIP); |
127 | for (unsigned i = 0; i < Cp1.size(); i++) { // for every point on the circle(+1 means closing the circle) | 127 | for (unsigned i = 0; i < Cp1.size(); i++) { // for every point on the circle(+1 means closing the circle) |
128 | + glTexCoord1f(E[e].r(p-1)); | ||
128 | glVertex3f(Cp1[i][0], Cp1[i][1], Cp1[i][2]); | 129 | glVertex3f(Cp1[i][0], Cp1[i][1], Cp1[i][2]); |
129 | - glVertex3f(Cp2[i][0], Cp2[i][1], Cp2[i][2]); | ||
130 | glTexCoord1f(E[e].r(p)); | 130 | glTexCoord1f(E[e].r(p)); |
131 | + glVertex3f(Cp2[i][0], Cp2[i][1], Cp2[i][2]); | ||
131 | } | 132 | } |
132 | glEnd(); | 133 | glEnd(); |
133 | } // set the texture coordinate based on the specified magnitude index | 134 | } // set the texture coordinate based on the specified magnitude index |