C++ Visual Studio 2017 OpenGL启动非常缓慢
我刚开始学习OpenGL事实上我刚开始学习一个叫做“learningopengl”的很棒的资源,这个资源教我如何设置GLFW,并且很高兴在visual studio 2017上使用OpenGL。然而,我注意到,即使只是运行一个非常基本的程序,也只能构建一个空白窗口,可以调整大小(按照学习材料),visual studio始终需要40秒左右的时间来实际加载该程序。它运行良好,一旦启动,只需花费令人烦恼的长时间即可打开 我知道这不会花太长时间,因为通过我的搜索和观看视频,人们在运行这些libs/include时会立即加载示例程序 我希望我能找出为什么会这样。下面显示了我正在运行的示例代码,以供参考C++ Visual Studio 2017 OpenGL启动非常缓慢,c++,visual-studio,opengl,visual-studio-2017,C++,Visual Studio,Opengl,Visual Studio 2017,我刚开始学习OpenGL事实上我刚开始学习一个叫做“learningopengl”的很棒的资源,这个资源教我如何设置GLFW,并且很高兴在visual studio 2017上使用OpenGL。然而,我注意到,即使只是运行一个非常基本的程序,也只能构建一个空白窗口,可以调整大小(按照学习材料),visual studio始终需要40秒左右的时间来实际加载该程序。它运行良好,一旦启动,只需花费令人烦恼的长时间即可打开 我知道这不会花太长时间,因为通过我的搜索和观看视频,人们在运行这些libs/in
#include <glad/glad.h>
#include <GLFW\glfw3.h>
#include <iostream>
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
int main() {
// glfw: initialize and configure
// -----------------------------
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// glfw window creation
// --------------------
GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL);
if (window == NULL) {
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
// glad: load all openGL function pointers
// ---------------------------------------
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
std::cout << "Failed to initialize GLAD" << std::endl;
return -1;
}
// render loop
// -----------
while (!glfwWindowShouldClose(window)) {
// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc
// -----------------------------------------------------------------------------
glfwSwapBuffers(window);
glfwPollEvents();
}
// glfw: terminate, clearing all perviously allocated glfw recourses
// -----------------------------------------------------------------
glfwTerminate();
return 0;
}
// glfw: whenever the window size is changed (by OS or user resize) this callback function executes
// ------------------------------------------------------------------------------------------------
void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
// make sure the viewport matches the new window dimensions; note that width and
// height will be significantly larger then specified on retina displays.
glViewport(0, 0, width, height);
}
#包括
#包括
#包括
无效帧缓冲区\大小\回调(GLFWwindow*窗口,整数宽度,整数高度);
int main(){
//glfw:初始化和配置
// -----------------------------
glfwInit();
glfwWindowHint(GLFW_上下文_版本_专业,3);
glfwWindowHint(GLFW_上下文_版本_小调,3);
glfwWindowHint(GLFW_OPENGL_配置文件、GLFW_OPENGL_核心配置文件);
//glfw窗口创建
// --------------------
GLFWwindow*window=glfwCreateWindow(800600,“LearnOpenGL”,NULL,NULL);
如果(窗口==NULL){
std::cout MSVC包含一个探查器,40延迟应该很容易发现。而且,在调试器中执行“单步执行”可能足以发现问题。在调试器下运行project时,Visual Studio将查找调试信息文件(.pdb)在每个加载的库中,如果需要,在Internet上查询它们。如果在每个模块加载后,在输出窗口中看到一个延迟,那么它肯定是一个PDB加载延迟。另一种可能是RAW杀毒软件。您应该将C++的项目空间添加到防病毒异常中。MSVC包括一个探查器,40延迟应该是。很容易发现。另外,只需在调试器中执行单步操作就足以找到问题。在调试器下运行project时,Visual Studio将查找调试信息文件(.pdb)对于每个加载的库,在必要时从Internet上查询它们。如果在输出窗口中看到每个模块加载后的延迟,那么它肯定是一个PDB加载延迟。另一种可能是RAW杀毒软件。您应该将C++的项目添加到反病毒异常中。