看了下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?

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

 

转载于:https://www.cnblogs.com/kgtone/p/10507415.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值