How to convert polygon which is drawn in MFC GDI(pen,brush etc ) into OpenGL

I have 2D mfc view where we can draw rectangles,circle etc .There is another viewer created using OpenGL. On switch to OpenGL view it should take polygons from MFC CView and draw in OpenGL view.

glBegin (GL_LINE_LOOP) ;
for (int i=0; i<isize; i++)
{
    CEntity *pEntity = pDoc->m_entityVector[i];
    if (CPolygon *ptrPolygon = dynamic_cast<CPolygon*>(pEntity)) // Rectangle
    {
        vector<CFloatPoint*> pointVector = ptrPolygon->getPointVector();
        for (int k =0;k<pointVector.size();k++) // four points
        {
                           CFloatPoint *point = pointVector.at(k);
                           glVertex2f(point->x,point->y);  
        }
    }         
}
glEnd();

In above code polygon is a rectangle .it’s drawing larger than original one.

do I need to convert 2D points into 3D points??

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.