小编Cir*_*cía的帖子

访问冲突执行位置 0x0000000000000000。带有 GLAD 和 GLFW 的 OpenGL

我一直在尝试按照learnopengl.comglfw.org 上的说明创建一个使用 GLAD 和 GLFW 的 OpenGL 窗口。乍一看,根据文档,这足以使窗口正常工作:

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

using namespace std;

// framebuffer size callback function
void resize(GLFWwindow* window, int width, int height)
{
    glViewport(0, 0, width, height);
}

void render(GLFWwindow* window) {

    // here we put our rendering code
    
}

void main() {

    int width = 800;
    int height = 600;

    // We initialzie GLFW
    glfwInit();
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); 
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

    // Now that it is initialized, we …
Run Code Online (Sandbox Code Playgroud)

c++ opengl glfw glad

2
推荐指数
1
解决办法
334
查看次数

标签 统计

c++ ×1

glad ×1

glfw ×1

opengl ×1