Hey guys, I am trying to create bezier spline as the user clicks on the screen. I am using Visual Studio 6 and I am using MFC for the application. Now as the user clicks the screen, a point is created and inserted into an array. And then I call the glMap1() everytime a new point is created to update the function parameter for the no. of control points and enable it. And then I render it using glEvalCoord1f(). Now for everytime the user clicks the screen, the glMap1() is called for the new point being inserted in the array.
I dont get it to work…that is the curve displayed is a straight line that goes into infinity.
Originally posted by <infinitecmdz>: Should I paste the code ?
Yes, please. But only the GL side of things, for brevity’s sake. MFC code can get a bit unwieldy
::glPointSize(10.0f) ;
m_ClickOglPoints = GetOglPos(m_CurrentPoint) ;
//Check if the point clicked is in the plane.
if(m_bIsClicked)
{
if(CurvePlane.IsPointInPolygon(Vector2(m_ClickOglPoints.x , m_ClickOglPoints.z)))
{
//Insert it into the control point list.
pDoc->m_pSpline->InsertPoint(m_ClickOglPoints) ;
pDoc->m_pSpline->InitDrawing() ;
}
}
pDoc->m_pSpline->DrawCurve(0.0f , 1.0f , 1.0f) ;
//pDoc->m_pSpline->DrawControlPoints() ;
m_bIsClicked = FALSE ;
::glEnable(GL_LIGHTING) ;
}