From ee649c5a21bc919c256c9be973bf790f3e40061a Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Sun, 1 Sep 2024 20:35:10 +0800 Subject: [PATCH] update --- src/c1/threePoints.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/c1/threePoints.cpp b/src/c1/threePoints.cpp index 366c0ad..a604e89 100644 --- a/src/c1/threePoints.cpp +++ b/src/c1/threePoints.cpp @@ -1,23 +1,25 @@ #include +#include +#include #include #include #include #include +#include #include #include const float POINT_SIZE = 32.0f; + void render(){ glBegin(GL_TRIANGLES); - glColor3f(1.0f,0.0f,0.0f); glVertex3f(0.0f,0.5f,0.0f); glColor3f(0.0f,1.0f,0.0f); glVertex3f(-0.5,-0.5,0.0f); glColor3f(0.0f,0.0f,1.0f); glVertex3f(0.5f,-0.5f,0.0f); - glEnd(); glBegin(GL_POINTS); @@ -31,10 +33,16 @@ void render(){ num=0.0f; speed=0.01f; } - - glColor3f(num,num,num); - glVertex3f(0.0f,0.0f,0.0f); - + glColor3f(num/1.11f,1.0f-(num/1.12f),num/1.13f); + static int bx=0,by=0,bsx=5,bsy=7; + glVertex3f(float(bx)/1000.0f,float(by)/1000.0f,0.0f); + bx+=bsx,by+=bsy; + if(bx>=1000||bx<=-1000){ + bsx=-bsx; + } + if(by>=1000||by<=-1000){ + bsy=-bsy; + } glEnd(); } @@ -59,17 +67,17 @@ int main(){ std::cout<<"OpenGL version:"<