PDA

View Full Version : position



pjean
04-23-2000, 09:53 AM
Hi guys,
I'm drawing a pseudo-nurbs with line strips and draw the points and I want to draw the control vectors :
glMap2f( GL_MAP2_VERTEX_3,...)
// draw strips
// then draw points
for ( w=0; w<WidNbr; w++ )
for ( h=0; h<HgtNbr; h++ )
{
glBegin( GL_POINTS );
glEvalCoord2f( [x],[y] );
glEnd();
}
and I try to get back the real position of each point.
I have tried with glGetFloatv and glGetMapfv but I can't get it.

Any idea?
Thanks
Pierre

Relic
04-25-2000, 12:23 PM
glEval...() is not updating the current state, as far as I remember, so glGet...() on the current vertex will return the last glVertex() data instead.

I haven't understood the meaning of "control vectors" though. Do you mean the first derivatives in u and v direction at each point?

pjean
04-25-2000, 03:52 PM
Hi Relic,
Thanks for your answer,
My mean is to find the XYZ coordinates of the point I just drawn.
If glEval doesn't update this data is there any other way to get this information(without recalculate with algorythms :-(
Regards
Pierre

Relic
04-25-2000, 10:20 PM
Sounds as if glRenderMode(GL_FEEDBACK) would return the data. That doesn't draw anything and isn't hardware accelerated normally.
But feedback is something I largely avoid.
Have a look in feedback.c of the redbook examples.
I did Bezier and B-spline patches myself after I had some weird experiences with two sided lighting with glEval. Haven't used glMap since then.

pjean
04-26-2000, 12:54 AM
So if you don't use glMap, what do you do? Do the calculations?
Do you think NURBS is more reliable?

Relic
04-26-2000, 02:49 AM
Depends on what you want to do. Knowing what happens in the graphics is always a plus.
I have written some algorithms which calculate the surface and normals of freeform patches for personal research. It's quick enough to be realtime editable, but I don't know how the code looks like anymore(three years ago, maybe), so I cannot offer it.
I rely on basic OpenGL features mainly. Stuff in libs I have no source access to must work or I simply kick it.
NURBS have less polygons than my algorithm, which simply interpolates in constant steps on u and v.
Give it a try. It's not that complicated with the glu lib, but if you need the final vertices for storing models you'll need the feedback buffer.