マウスドラッグで滑らかな円を描きたい。つまり、最初のマウス クリックで始点が設定され、マウスをドラッグすると終点が更新され、円が拡大されます。ラインストリップを使用して描画できる場所を読みました。しかし、それは私の要件には合いません。
つまり、opengl を使用して、指定された 2 点を使用して円を描くロジックが必要です。
さて、あなたが持っているなら:
top-left position (X1 Y1) 
と
bottom-right position (X2 Y2)
あなたも持っています
diameter (sqrt([X2-X1]^2+[Y2-Y1]^2))
radius (diameter/2)
そしてセンター:
CenterX = X1 + (radius * (sin(-atan2(Y2-Y1,X2-X1))));
CenterY = Y1 + (radius * (cos(-atan2(Y2-Y1,X2-X1))));
その時点から、任意の方法で、指定された半径で中心から円を描くことができます!
double max = 2.0 * PI;
double precision = 0.1;
double current = 0.0;
struct point
{
    double x;
    double y;
};
while(current <= max)
{
    point one;
    point two;
    one.x = Center.x + (radius * (sin(-current)));
    one.y = Center.y + (radius * (cos(-current)));
    current += precision;
    two.x = Center.x + (radius * (sin(-current)));
    two.y = Center.y + (radius * (cos(-current)));
    //draw line between one and two?
    //draw here
}
(線はあなたが望むものではないので、これ以上答えませんか?「円」を「描く」他の方法を知りません)
ByTheWay: このコードを正しく修正することで、「疑似円」の一部を描くこともできます ( while(current<=max))
とにかく、これは私のコードで円を描く方法です:
//draw fun
{
    struct point
    {
        double x,y;
        point(double x,double y) : x(x), y(y) {}
        point(){ x = 0.0, y = 0.0; }
    };
    point start(100.0,100.0);
    point end(150.0,150.0);
    point center;
    double diameter = sqrt(pow(end.x-start.x,2.0)+pow(end.y-start.y,2.0));
    double radius = diameter/2.0;
    double max = 2.0 * PId;
    double precision = max/180.0;
    double current = 0.0;
    center.x = start.x + (radius * (sin(-atan2(end.y-start.y,end.x-start.x))));
    center.y = start.y + (radius * (cos(-atan2(end.y-start.y,end.x-start.x))));
    //render->BeginRender();
    while(current <= max)
    {
        point one;
        //point two;
        one.x = center.x + (radius * (sin(-current)));
        one.y = center.y + (radius * (cos(-current)));
        render->D3DBox((float)one.x,(float)one.y,1.0f,1.0f,0xFFFFFFFF);//create a dot
        current += precision;
        //two.x = center.x + (radius * (sin(-current)));
        //two.y = center.y + (radius * (cos(-current)));
        //
        //render->DrawLine(D3DXVECTOR3((float)one.x,(float)one.y,1.0),D3DXVECTOR3((float)two.x,(float)two.y,1.0),0xFFFFFFFF);
    }
    //render->EndRender();
}
出力:
