#include #include #include #include #include #include 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(){ // 初始化GLFW if(glfwInit()==0){ throw std::runtime_error("failed to init GLFW"); } GLFWwindow *window = glfwCreateWindow(640,480,"Example",nullptr,nullptr); if(window==nullptr){ glfwTerminate(); throw std::runtime_error("GLFW failed to create window"); } glfwMakeContextCurrent(window);//创建上下文 if(gladLoadGL()==0){ //加载GL函数 glfwTerminate(); throw std::runtime_error("GLAD Load GL functions failed"); } std::cout<<"OpenGL version:"< int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { main(); } #endif