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?

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

  • 相关阅读:
    css grid 随笔
    网页“console”输出图文信息
    2017
    自适应css 框架 PURE
    获取去除参数url地址
    微信分享
    video 播放
    手机端 默认字体
    video 手机全屏自动播放
    jquery 获取元素背景图片backgroungImage的url
  • 原文地址:https://www.cnblogs.com/kgtone/p/10507415.html
Copyright © 2011-2022 走看看