update
This commit is contained in:
parent
1b358909cc
commit
98cf7a3229
@ -1,12 +1,18 @@
|
|||||||
#include <chrono>
|
|
||||||
#include <exception>
|
|
||||||
#include <fstream>
|
|
||||||
#include<glad/glad.h>
|
#include<glad/glad.h>
|
||||||
#include<GLFW/glfw3.h>
|
#include<GLFW/glfw3.h>
|
||||||
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
void render(){
|
||||||
|
glBegin(GL_POINTS);
|
||||||
|
glVertex3f(0.0f,0.5f,0.0f);
|
||||||
|
glVertex3f(-0.5,-0.5,0.0f);
|
||||||
|
glVertex3f(0.5f,-0.5f,0.0f);
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
// 初始化GLFW
|
// 初始化GLFW
|
||||||
if(glfwInit()==0){
|
if(glfwInit()==0){
|
||||||
@ -28,10 +34,17 @@ int main(){
|
|||||||
|
|
||||||
std::cout<<"OpenGL version:"<<glGetString(GL_VERSION)<<"\n";
|
std::cout<<"OpenGL version:"<<glGetString(GL_VERSION)<<"\n";
|
||||||
|
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
glEnable(GL_POINT_SMOOTH);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glPointSize(64.0f);
|
||||||
|
|
||||||
while(glfwWindowShouldClose(window)==false){
|
while(glfwWindowShouldClose(window)==false){
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000/60));
|
render();
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(1000/60));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user