小编ssj*_*ack的帖子

为什么需要检查 GLAD 或 GLEW 是否正确初始化?

我正在使用 GLFW + GLAD 或 GLEW ( ) 设置 opengl #include glad/glad.h #include <GL/glew.h>。在该函数之后,glfwMakeContextCurrent(window);我需要检查 GLAD 或 GLEW 是否已正确初始化,否则我将在 Visual Studio 2019 中遇到异常错误

#include <glad/glad.h>
#include <GLFW/glfw3.h>

#include <iostream>
using namespace std;

int main(void) {

GLFWwindow* window;

/* Initialize the library */
if (!glfwInit())
    return -1;

/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
    glfwTerminate();
    return -1;
}

/* Make the window's …
Run Code Online (Sandbox Code Playgroud)

c++ opengl glew visual-studio

0
推荐指数
1
解决办法
2956
查看次数

标签 统计

c++ ×1

glew ×1

opengl ×1

visual-studio ×1