@@ -55,7 +55,6 @@ pp_addhdr('
5555 int i; \
5656 for (i = 0; i < 3; i++) v[i] *= fac; \
5757 }
58- #define BUFFER_OFFSET(i) ((char *)NULL + (i))
5958');
6059
6160my @internal = (Doc => 'internal', NoPthread => 1);
@@ -66,13 +65,13 @@ pp_def(
6665 Pars => '
6766 [o] vertices(tri=3,nVert=CALC(calc_nVert($COMP(slices),$COMP(stacks))));
6867 [o] normals(tri,nVert);
69- uint [o] stripIdx(nperpart =CALC(calc_numVertIdxsPerPart ($COMP(slices))),nstacks );',
70- OtherPars => 'float radius; int slices; int stacks => nstacks ;',
68+ uint [o] stripIdx(nidx =CALC(calc_numIdxs ($COMP(slices),$COMP(stacks))) );',
69+ OtherPars => 'float radius; int slices; int stacks;',
7170 CHeader => <<'EOF',
7271char *fghGenerateSphere(float radius, int slices, int stacks, float *vertices, float *normals, int nVert);
7372void calc_strip_idx(uint32_t *stripIdx, int slices, int stacks, int nVert);
7473int calc_nVert(int slices, int stacks);
75- int calc_numVertIdxsPerPart (int slices);
74+ int calc_numIdxs (int slices, int stacks );
7675EOF
7776 Code => <<'EOF',
7877/* Generate vertices and normals */
@@ -90,7 +89,7 @@ pp_def(
9089 'gl_spheres',
9190 GenericTypes => $F,
9291 Pars => 'coords(tri=3,n);',
93- OtherPars => 'int dim0; int dim1 => nstacks; ',
92+ OtherPars => 'int dim0;',
9493 Code => <<'EOF',
9594float oldcoord0 = 0.0, oldcoord1 = 0.0, oldcoord2 = 0.0;
9695glPushMatrix();
@@ -100,9 +99,7 @@ loop(n) %{
10099 $coords(tri=>1) - oldcoord1,
101100 $coords(tri=>2) - oldcoord2
102101 );
103- loop (nstacks) %{
104- glDrawElements(GL_TRIANGLE_STRIP, $COMP(dim0), GL_UNSIGNED_INT, BUFFER_OFFSET(nstacks * $COMP(dim0) * sizeof(PDL_ULong)));
105- %}
102+ glDrawElements(GL_TRIANGLE_STRIP, $COMP(dim0), GL_UNSIGNED_INT, 0);
106103 oldcoord0 = $coords(tri=>0), oldcoord1 = $coords(tri=>1), oldcoord2 = $coords(tri=>2);
107104%}
108105glPopMatrix();
0 commit comments