Jump to content
  • Advertisement
Sign in to follow this  
bobofjoe

OpenGL Troubles Using GLEW

This topic is 4144 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have been trying to use GLEW to enable the use of shaders in my program. However, I have been unable to get GLEW to work, much less the shaders. Whenever I call any function that should have been included from the extension, my compiler spews various "undefined references"
918: undefined reference to `_imp____glewCreateShaderObjectARB'
919: undefined reference to `_imp____glewCreateShaderObjectARB'
920: undefined reference to `_imp____glewCreateShaderObjectARB'
931: undefined reference to `_imp____glewShaderSourceARB'
932: undefined reference to `_imp____glewShaderSourceARB'
933: undefined reference to `_imp____glewShaderSourceARB'
937: undefined reference to `_imp____glewCompileShaderARB'
938: undefined reference to `_imp____glewCompileShaderARB'
939: undefined reference to `_imp____glewCompileShaderARB'
941: undefined reference to `_imp____glewCreateProgramObjectARB'
942: undefined reference to `_imp____glewAttachObjectARB'
943: undefined reference to `_imp____glewAttachObjectARB'
944: undefined reference to `_imp____glewAttachObjectARB'
946: undefined reference to `_imp____glewLinkProgramARB'
947: undefined reference to `_imp____glewUseProgramObjectARB'


The code that creates these errors is as follows (A direct copy of the example file from the GLSL tutorial found on lighthouse3d, found here
void glBase::CreateShaders()
{
	char *vs = NULL,*fs = NULL,*fs2 = NULL;

	v = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
	f = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
	f2 = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);


	vs = textFileRead("toon.vert");
	fs = textFileRead("toon.frag");
	fs2 = textFileRead("toon2.frag");

	const char * ff = fs;
	const char * ff2 = fs2;
	const char * vv = vs;

	glShaderSourceARB(v, 1, &vv,NULL);
	glShaderSourceARB(f, 1, &ff,NULL);
	glShaderSourceARB(f2, 1, &ff2,NULL);

	free(vs);free(fs);

	glCompileShaderARB(v);
	glCompileShaderARB(f);
	glCompileShaderARB(f2);

	p = glCreateProgramObjectARB();
	glAttachObjectARB(p,f);
	glAttachObjectARB(p,f2);
	glAttachObjectARB(p,v);

	glLinkProgramARB(p);
	glUseProgramObjectARB(p);
}


Before I call that code, I call this
    if (glewInit() != GLEW_OK)
    {
        Logger::Log("GLEW Did not initilize properly.");
    }

    if (glewIsSupported("GL_ARB_vertex_shader"))
    {
        Logger::Log("Vertex Shader Availiable.");
        VertexShader = true;
    }

    if (glewIsSupported("GL_ARB_fragment_shader"))
    {
        Logger::Log("Fragment Shader Availiable.");
        FragmentShader = false;
    }
    if (VertexShader && FragmentShader)
    {
        CreateShaders();
    }


Any help would be appreciated. I am using Code::blocks, SVN 3737 with the MinGW compiler.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!