只是一小段代码,创建一个窗口进行颜色清除。。但是VS中的渲染窗口跳一下就闪退了。。不知道怎么解决。。请各位大佬看看Orz
自己试着在return 0 前面加上system("pause"),然后glfw创建出的窗口就卡在那了。。
VS配置都配置完了,该导入的也导入了也没有报错。。。。QAQ
[code=c]
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include<iostream>
using namespace std;
void init(GLFWwindow *window){ }
void display(GLFWwindow* window, double currentTime) {
glClearColor(1.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
}
int main() {
if (!glfwInit()) { exit(EXIT_FAILURE); }
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
GLFWwindow* window = glfwCreateWindow(600, 600, "Chapter2 - program1", NULL, NULL);
glfwMakeContextCurrent(window);
if (glewInit() != GLEW_OK) { exit(EXIT_FAILURE); }
glfwSwapInterval(1);
init(window);
while (glfwWindowShouldClose(window)) {
display(window, glfwGetTime());
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_SUCCESS);
return 0;
}
[/code]
自己试着在return 0 前面加上system("pause"),然后glfw创建出的窗口就卡在那了。。
VS配置都配置完了,该导入的也导入了也没有报错。。。。QAQ
[code=c]
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include<iostream>
using namespace std;
void init(GLFWwindow *window){ }
void display(GLFWwindow* window, double currentTime) {
glClearColor(1.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
}
int main() {
if (!glfwInit()) { exit(EXIT_FAILURE); }
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
GLFWwindow* window = glfwCreateWindow(600, 600, "Chapter2 - program1", NULL, NULL);
glfwMakeContextCurrent(window);
if (glewInit() != GLEW_OK) { exit(EXIT_FAILURE); }
glfwSwapInterval(1);
init(window);
while (glfwWindowShouldClose(window)) {
display(window, glfwGetTime());
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_SUCCESS);
return 0;
}
[/code]