On Jun 16, 2004, at 4:51 AM, andreas.poegl wrote:
> thanx for answering..
> my problem is that i want to create chladni-figures resulting from an
> analysis within pd
> the chladni code uses forms like 'for' and i don't know how to
> implement in gem.
> ist there are kind of GEMfor ?
> here is thwe oGL code
Since you already have the C code then it only makes sense to write an
external. this will be far faster to write and also run a whole lot
better as well. Implementing the following using wrapper objects is
going to be nothing but frustration. I have no idea how you would do
Paul Bourke's Eval and CalcNormals in a sane manner either.
There is a good chance the next release of GEM might have an object or
two based on a few of Bourke's ideas.
cgc
> du = TWOPI / (double)resolution; /* Theta */
> dv = PI / (double)resolution; /* Phi */
>
>
> glBegin(GL_QUADS);
> for (i=0;i<resolution;i++) {
> u = i * du;
> for (j=0;j<resolution;j++) {
> v = j * dv;
> q[0] = Eval(u,v);
> n[0] = CalcNormal(q[0],
> Eval(u+du/10,v),
> Eval(u,v+dv/10));
> c[0] = GetColour(u,0.0,TWOPI,colourmap);
> glNormal3f(n[0].x,n[0].y,n[0].z);
> glColor3f(c[0].r,c[0].g,c[0].b);
> glVertex3f(q[0].x,q[0].y,q[0].z);
>
>
> q[1] = Eval(u+du,v);
> n[1] = CalcNormal(q[1],
> Eval(u+du+du/10,v),
> Eval(u+du,v+dv/10));
> c[1] = GetColour(u+du,0.0,TWOPI,colourmap);
> glNormal3f(n[1].x,n[1].y,n[1].z);
> glColor3f(c[1].r,c[1].g,c[1].b);
> glVertex3f(q[1].x,q[1].y,q[1].z);
>
>
> q[2] = Eval(u+du,v+dv);
> n[2] = CalcNormal(q[2],
> Eval(u+du+du/10,v+dv),
> Eval(u+du,v+dv+dv/10));
> c[2] = GetColour(u+du,0.0,TWOPI,colourmap);
> glNormal3f(n[2].x,n[2].y,n[2].z);
> glColor3f(c[2].r,c[2].g,c[2].b);
> glVertex3f(q[2].x,q[2].y,q[2].z);
>
>
> q[3] = Eval(u,v+dv);
> n[3] = CalcNormal(q[3],
> Eval(u+du/10,v+dv),
> Eval(u,v+dv+dv/10));
> c[3] = GetColour(u,0.0,TWOPI,colourmap);
> glNormal3f(n[3].x,n[3].y,n[3].z);
> glColor3f(c[3].r,c[3].g,c[3].b);
> glVertex3f(q[3].x,q[3].y,q[3].z);
> }
> }
> glEnd();
>
>
> regards andreas