首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在给定所有所需库的情况下无法识别glMatrixMode()或GL_PROJECTION

在给定所有所需库的情况下无法识别glMatrixMode()或GL_PROJECTION
EN

Stack Overflow用户
提问于 2014-05-04 16:37:38
回答 1查看 1.9K关注 0票数 0

我想使用OpenGL和C++来创建一个基本场景,其中包含一个“摄像机”(透视)和一个可以查看的对象。我找到了一个示例代码这里。但出于某种原因,尽管我把所有必要的包含和库绑定在一起(见下文),

代码语言:javascript
复制
// OpenGL init and components:
#include <glload/gl_3_3.h>
#include <glload/gl_load.hpp>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/freeglut.h>
#include <excpt.h>
#include <glm/glm.hpp>

IDE ( 2012 for Windows桌面)不同意我的观点:

如果你需要更多的信息,请告诉我。

=============================================================================

更新:在修改了一些与opengl相关的文件之后,我想出了如下内容:

代码语言:javascript
复制
// Basics:
#include <windows.h>
#include <string>
#include <exception>
#include <stdexcept>
#include <stdio.h>
#include <stdlib.h>

// OpenGL init and components:
#include <glload/gl_3_1_comp.h>
#include <glload/gl_3_2_comp.h>

#include <glload/gl_3_3.h>

#include <glload/gl_4_0_comp.h>
#include <glload/gl_4_1_comp.h>
#include <glload/gl_4_2_comp.h>
#include <glload/gl_4_3_comp.h>
#include <glload/gl_4_4_comp.h>

#include <glload/gl_load.hpp>
#include <GL/glew.h>
#include <GL/freeglut.h>
#include <excpt.h>
#include <glm/glm.hpp>

它告诉我,GLEW_OK是没有定义的,尽管它就在这里:

代码语言:javascript
复制
#define GLEW_OK 0
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-05-04 16:58:55

我知道你在用格鲁,你打电话给glewInit()了吗

还要确保您正在检查初始化是否成功。

代码语言:javascript
复制
GLenum err = glewInit();
if (GLEW_OK != err)
{
  /* Problem: glewInit failed, something is seriously wrong. */
  fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
}

或者,就像今天早上发生在我身上的一样,重新启动解决了我的问题

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23458752

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档