这是基于OpenGL的代码,把它放进draw中即可。渲染出来的效果还不错

 #define  PI 3.14159
#define N 100
void test::Draw()
{
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // 设置刷新背景色
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);// 刷新背景
glLoadIdentity();
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE );
glDisable( GL_DEPTH_TEST );
glDisable( GL_TEXTURE_2D ); #pragma region 圆圈轨迹
glPushMatrix();
glColor4f(1.0f,1.0f,1.0f,1.0f);
float step,zstep;
step=1.0*PI/N;
zstep=1.0/N;
glBegin(GL_LINES);
float factor=2.0f;
float length=3.0f;
float HOT=2.0f;
float COLD=0.0f;
GLfloat z=0.0f;
while (factor>)
{
setColor(length,HOT,COLD);
for (int i=;i<(int)(*N);i++)
{
GLfloat x=factor*cos(step*i);
GLfloat y=factor*sin(step*i);
//GLfloat z=zstep*i;
glVertex3f(x,y,z);
glVertex3f(x,y,z+length);
}
factor=factor-0.05f;
length=length-0.1f;
}
glEnd();
glPopMatrix();
#pragma endregion
} void test::setColor(float t,float HOT,float COLD)
{
float r,g,b;
r=(t-COLD)/(HOT-COLD);
g=0.0;
b=1.0-r;
glColor3f(r,g,b);
}
05-08 08:37