如何在OpenGl窗口上画圆?我用的投影模式是glOrtho,
在窗口中,中心点在窗口中心,我要随鼠标移动来改变圆的半径,
在线等,急.........急.........马上解决,立刻给分

解决方案 »

  1.   

    我作的一个例子去看
    http://www.86vr.com/teach/cursor/200504/5470.html
      

  2.   

    typedef struct
    {
    double rgbr;
    double rgbg;
    double rgbb;
    double x;
    double y;
    double r;
    double size;
    }cirStruct;
    vector<cirStruct> circles;
    cirStruct cirpot;
    cirpot.x=x;
    cirpot.y=y;
    cirpot.rgbr=localcolor.r;
    cirpot.rgbg=localcolor.g;
    cirpot.rgbb=localcolor.b;
    cirpot.size=local_size;
    cirpot.r=sqrt((x-cirpot.x)*(x-cirpot.x)+(y-cirpot.y)*(y-cirpot.y));
    circles.push_back(cirpot);
    for(vector<cirStruct>::iterator cir=circles.begin();cir!=circles.end();cir++)
    {
    for(double i=1;i<=circle_total;i+=(2*3.1416/circle_total))
    {
    glLineWidth(cir->size);
    glBegin(GL_LINES);
        glColor3f(cir->rgbr,cir->rgbg,cir->rgbb);
    glVertex2f(cir->x+(cir->r)*sin(i),cir->y+(cir->r)*cos(i));
    glVertex2f(cir->x+(cir->r)*sin(i+(2*3.1416/circle_total)),cir->y+(cir->r)*cos(i+(2*3.1416/circle_total)));
    glEnd();
    }
    }
    直接从我以前写的东西里拉出来的
    可能看起来麻烦了点 画是可以画的。