示例#1
0
void drawPolyline(pointList list)
{
    if(list.size() < 2)
        return;

    glBegin(GL_LINE_STRIP);
    {
        pointList::const_iterator endIt = list.end();
        for(pointList::const_iterator it = list.begin(); it != endIt; ++it) {
            glVertex2d(it->first, it->second);
        }
    }
    glEnd();
}
示例#2
0
void mouse(int button, int state, int x, int y)
{
    (void)x;
    (void)y;

    if(state != GLUT_DOWN)
        return;

    if(button == GLUT_LEFT_BUTTON) {
        g_pointList.push_back(point((GLfloat) x, (GLfloat) y));
        std::cout << "X : " << x << " | Y : " << y << std::endl;
    }

    if(button == GLUT_RIGHT_BUTTON)
        g_pointList.clear();

    std::cout << "DATA SIZE : " << g_pointList.size() << std::endl;

#ifdef __GNUC__
     display();
#endif // __GNUC__
}