This commit is contained in:
Zengtudor 2024-09-01 18:11:59 +08:00
parent 98cf7a3229
commit c6d3c704ec
2 changed files with 24 additions and 2 deletions

View File

@ -1,3 +1,4 @@
#include <cmath>
#include<glad/glad.h>
#include<GLFW/glfw3.h>
#include <chrono>
@ -6,10 +7,31 @@
#include <thread>
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();
}

View File

@ -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")