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?

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

  • 相关阅读:
    hdu 3033 I love sneakers!
    poj 1742 Coins
    poj 1276 Cash Machine
    hdu 1114 Piggy-Bank
    poj 1293 Duty Free Shop
    hdu 1203 I NEED A OFFER!
    hdu 2546 饭卡
    树的直径
    CF 337D Book of Evil
    ST表
  • 原文地址:https://www.cnblogs.com/kgtone/p/10507415.html
Copyright © 2011-2022 走看看