PDA

View Full Version : Opengl - Shader problem



shawn619
03-24-2012, 02:23 AM
I'm trying to mimic the shader used in opengl.org website http://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/lighting.php , but i only got so far as declaring the following object:


cwc::glShaderManager SM;


when i got these errors:


error LNK2001: unresolved external symbol "public: __thiscall cwc::glShaderManager::glShaderManager(void)" 0glShaderManager@cwc@@QAE@XZ"]??0glShaderManager@cwc@@QAE@XZ)
error LNK2001: unresolved external symbol "public: virtual __thiscall cwc::glShaderManager::~glShaderManager(void)" 1glShaderManager@cwc@@UAE@XZ"]1glShaderManager@cwc@@UAE@XZ)


I included all the necessary includes exactly the same as the project on the website has it. I don't know why im getting linker errors when i never added any shader linkers, and this is because the project on the website didnt have any shader linkers.

My linkers are this:


SOIL.lib
opengl32.lib
glu32.lib
glut32.lib


How can i solve these errors?

mobeen
03-25-2012, 09:38 PM
This seems to be a problem with the C++ code. Have you implemented the constructor/destructor pair in the cwc::glShaderManager class?

shawn619
03-26-2012, 02:36 AM
I didn't personally make the class i just took it from opengl.org.
The glShaderManager in the glsl file. Here are some excerpts from the header and source relating to the glShaderManager class

glsl.h


namespace cwc
{
class glShaderManager;
class GLSLAPI glShader
{
friend class glShaderManager;
}
class GLSLAPI glShaderManager
{
public:
glShaderManager();
virtual ~glShaderManager();
}



glsl.cpp


// ShaderManager: Easy use of (multiple) Shaders

glShaderManager::glShaderManager()
{
InitOpenGLExtensions();
_nInputPrimitiveType = GL_TRIANGLES;
_nOutputPrimitiveType = GL_TRIANGLE_STRIP;
_nVerticesOut = 3;

}

glShaderManager::~glShaderManager()
{
// free objects
vector<glShader*>::iterator i=_shaderObjectList.begin();
while (i!=_shaderObjectList.end())
{
//glShader* o = *i;
i=_shaderObjectList.erase(i);
//delete o;
}
}

shawn619
03-26-2012, 11:37 PM
bump