glActiveTexture导致"已停止工作"错误

时间:2016-01-09 21:23:09

标签: opengl glew

我的IDE无法识别glActiveTexture方法。 我已经安装了freeglut和GLEW lib,当我构建我的项目IDE没有显示任何错误但是当我运行程序时我已经停止了工作"类型错误。我真的不知道如何修复它以及导致这个问题的原因。 另一个想法是IDE知道函数的名称(这个#thing)但我不知道函数本身(它应该是()符号就像在第一个函数中一样)。 glActiveTexture

我希望有人知道这个问题的解决方案。

EDIT1 这是我的示例代码:

#define GLEW_STATIC
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#endif

#include <iostream>
#include <stdlib.h>
using namespace std;
int main(int argc, char *argv[])
{
    glutInit(&argc, argv);
    GLenum err = glewInit();
    if (GLEW_OK != err)
    {
        cout<<"Error: "<<glewGetErrorString(err)<<endl;
    }
    else cout<<"Initialized"<<endl;

    return EXIT_SUCCESS;
}

我正在Error: Missing GL version

这是glewinfo:

GLEW version 1.13.0
Reporting capabilities of pixelformat 3
Running on a Intel(R) HD Graphics 4600 from Intel
OpenGL version 4.3.0 - Build 10.18.10.3960 is supported

1 个答案:

答案 0 :(得分:1)

您需要在调用glewInit之前创建OpenGL渲染上下文:

glutInit(&argc, argv);
glutCreateWindow("My Program");
GLenum err = glewInit();

有关详细信息,请参阅here

相关问题