【发布时间】:2015-05-02 23:13:06
【问题描述】:
我有一个关于 OpenGL+GLEW 的小应用程序。现在,我正在尝试用 QT(而不是 GLEW)重写它。但我有一个问题。 IDE 写道:
'glActiveTexture' was not declared in this scope
glActiveTexture(TextureUnit);
^
这是 .cpp 文件中的代码:
#include <iostream>
#include "texture.h"
Texture::Texture(GLenum TextureTarget, std::string& FileName)
{
m_textureTarget = TextureTarget;
m_fileName = FileName;
}
bool Texture::Load()
{
// A lot of code for reading the picture.
}
void Texture::Bind(GLenum TextureUnit)
{
glActiveTexture(TextureUnit);
glBindTexture(m_textureTarget, m_textureObj);
}
这是来自 .h 文件的代码。
#ifndef TEXTURE_H
#define TEXTURE_H
#include <string>
#include <QGLWidget>
class Texture
{
public:
Texture(GLenum TextureTarget, std::string& FileName);
bool Load();
void Bind(GLenum TextureUnit);
private:
std::string m_fileName;
GLenum m_textureTarget;
GLuint m_textureObj;
unsigned int width, height;
unsigned char * data;
};
#endif /* TEXTURE_H */
我开始认为 Qt 不具备这样的功能。 我怎么解决这个问题? 我很高兴有任何想法。
【问题讨论】:
标签: qt opengl glew qglwidget qt5.3