A question about evaluator

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

A question about evaluator

JimmyCai
Hi, I have a question about evaluator. let's see codes first

void init(void)
{
        glClear(0.0,0.0,0.0,0.0);
        glShaderModel(GL_FLAT);
        glMap1f(GL_MAP1_VERTEX_3,0.0,1.0,3,4,&ctrlPoints[0][0]);
        glEnable(GL_MAP1_VERTEX_3);
}

void display(void)
{
       glClear(GL_COLOR_BUFFER_BIT);
       glColor3f(1.0,1.0,1.0);
       glBegin(GL_LINE_STRIP);
            for(int i=0;i<30;i++)
               glEvalCoord1f((float)i/30.f);----------(1)
       glEnd();
}

in (1), can I get the precise coord after evaluate, which API should I use?

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: A question about evaluator

Xerxes Rånby
JimmyCai wrote
Hi, I have a question about evaluator. let's see codes first
...
        glMap1f(GL_MAP1_VERTEX_3,0.0,1.0,3,4,&ctrlPoints[0][0]);
        glEnable(GL_MAP1_VERTEX_3);
...
         glEvalCoord1f((float)i/30.f);----------(1)
...

in (1), can I get the precise coord after evaluate, which API should I use?
No, its not possible to use glEvalCoord1f and in this case retrieve the evaluated value.
In your code glEvalCoord1f will get transformed into a glVertex call, because you have used glEnable using a GL_MAP1_VERTEX_3,  there exist no fixed OpenGL function to return the parameters passed to the last glVertex call; it is simply not part of the OpenGL spec.

You need to create your own function that perform the same logic and run it on the CPU if you want to retrieve the value.
Reply | Threaded
Open this post in threaded view
|

Re: A question about evaluator

JimmyCai
yeah, I got it, Thanks