From c6d3c704ec2da9e682c71df4302655bf1925bd67 Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Sun, 1 Sep 2024 18:11:59 +0800 Subject: [PATCH] update --- src/c1/threePoints.cpp | 24 +++++++++++++++++++++++- xmake.lua | 2 +- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/c1/threePoints.cpp b/src/c1/threePoints.cpp index 45372bf..6623ef4 100644 --- a/src/c1/threePoints.cpp +++ b/src/c1/threePoints.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -6,10 +7,31 @@ #include void render(){ - glBegin(GL_POINTS); + 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); + static float num = 0.0f; + static float speed = 0.01f; + num+=speed; + if(num>1.0f){ + num=1.0f; + speed = -0.01f; + }else if(num<0.0f){ + num=0.0f; + speed=0.01f; + } + glColor3f(num,num,num); + glVertex3f(0.0f,0.0f,0.0f); + glEnd(); } diff --git a/xmake.lua b/xmake.lua index 5b717a3..9fae909 100644 --- a/xmake.lua +++ b/xmake.lua @@ -15,5 +15,5 @@ end add_requires("glfw","glad","glm") add_packages("glfw","glad","glm") -target("3point") +target("3Points") add_files("src/c1/threePoints.cpp") \ No newline at end of file