glow和gltools的问题,_glewInit已经定义
Problems with glew and gltools, _glewInit already defined
我正试图从opengl Superbible示例添加着色器到我的程序。问题是,当我从gltools调用任何函数时,我得到
glew32.lib(glew32.dll) : error LNK2005: _glewInit already defined in gltools.lib(glew.obj)
之后,我交换了glew32。使用glew32 . Lib。这导致
处出现未处理的异常。const M3DMatrix44f& GetMatrix(void) { return pStack[stackPointer]; }
我添加的代码
void Shadders::RenderScene()
{
static CStopWatch rotTimer;
// Clear the window and the depth buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
modelViewMatrix.PushMatrix(viewFrame);
modelViewMatrix.Rotate(rotTimer.GetElapsedSeconds() * 10.0f, 0.0f, 1.0f, 0.0f);
GLfloat vColor[] = { 0.1f, 0.1f, 1.f, 1.0f };
glUseProgram(flatShader);
glUniform4fv(locColor, 1, vColor);
glUniformMatrix4fv(locMVP, 1, GL_FALSE, transformPipeline.GetModelViewProjectionMatrix()); // The line that causes the unhandled exception
torusBatch.Draw();
modelViewMatrix.PopMatrix();
glutSwapBuffers();
glutPostRedisplay();
}
当我尝试使用
时 GLfloat modmatrix[16], projmatrix[16];
glGetFloatv(GL_PROJECTION_MATRIX, projmatrix);
glGetFloatv(GL_MODELVIEW_MATRIX, modmatrix);
//M3DMatrix44f
float MDWPRJMatrix[16];
m3dMatrixMultiply44(MDWPRJMatrix, modmatrix, projmatrix);
glUniformMatrix4fv(locMVP, 1, GL_FALSE, MDWPRJMatrix);
我得到断言失败表达式:OPENGLUT_READY
我想知道是什么原因造成的,如果可能的话,如何解决它提前感谢
通过链接glew32s解决。lib和添加#define GLEW_STATIC
在我的代码的开始。此外,链接的freeglut,而不是openglut。
相关文章:
- 在提升multi_index容器中,是否定义了"default index"?
- #定义c-预处理器常量..我做错了什么
- 用C++中的一个变量定义一个常量
- 部分定义/别名模板模板参数
- C++映射:具有自定义类的运算符[]不起作用(总是返回0)
- #为""定义宏;静态";针对不同的上下文
- 如何确保C++函数在定义之前声明(如override关键字)
- 创建一个函数以在输入为负数或零时输出字符串.第一次执行用户定义的函数
- 当类在C++中定义时,有什么方法可以"register"类吗?
- 在命名空间中定义函数还是限定函数
- 此代码是否违反一个定义规则
- 编译C++时未定义的引用
- 不同翻译单元中不可重载的非内联函数定义
- 为什么在定义函数之前先声明它
- 有没有什么方法可以使用一个函数中定义的常量变量,也可以由c++中同一程序中的其他函数使用
- 在类定义之后定义一个私有方法
- 使用用户定义函数的字符串反转
- 用户定义函数中的指针和输入
- 未定义对glewInit()的引用@0
- glewInit未定义,但glewExperimental未定义