zoukankan      html  css  js  c++  java
  • 看了下opengl相关的资料,踩了一个坑,记录一下

    2019/03/10 下午看了下关于opengl的资料,然后把敲了下代码,然后程序报错了。代码如下:

    #include <glad/glad.h>
    #include <GLFW/glfw3.h>
    #include <iostream>
    
    int main()
    {
        glfwInit();
        glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
        glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
        glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
        //glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
      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);
        return 0;
    }
    下面这句代码直接返回的window直接是一个NULL,
    GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL);
    然后我在网上查了半天,试了下都不靠谱。然后我google了一下,发现stackOverFlow网站里面有一个回答。

    Docs say "Windows: Window creation will fail if the Microsoft GDI software OpenGL implementation is the only one available." What video card are you using, do you have the latest driver, and are you running remote desktop or in the console session?

    我突然想起来我是在用我的笔记本远程我的台式机来调试代码的(天太冷了,坐床上舒服一些),然后我关了远程,直接在台式机上面运行,没有任何问题。。。。。。

  • 相关阅读:
    Nginx模块fastcgi_cache的几个注意点
    Nginx的fastcgi_cache
    Nginx Location 语法,与简单配置[转]
    nginx location 匹配顺序
    Amoeba基本配置
    LVS的DR模式配置
    Keepalived安装及初步使用
    HAProxy安装及初步使用
    lvs nginx HAProxy优缺点
    Redis安装及初步使用
  • 原文地址:https://www.cnblogs.com/kgtone/p/10507415.html
Copyright © 2011-2022 走看看