View Full Version : glCreateShader include directory?

Tom Chesters
05-15-2011, 03:11 PM
I want to create a GLSL shader program, but my compiler says it cant find the function glCreateShader(), what file do i need to include for this function and other glsl shader functions?

05-15-2011, 03:27 PM
Have you checked your gl.h file?
Do you maintain this yourself or do you use someone elses?

Alfonse Reinheart
05-15-2011, 03:52 PM
You need an OpenGL extension loading library (http://www.opengl.org/wiki/Extension_Loading_Library) to use them. Or you could write one yourself.

Tom Chesters
05-16-2011, 12:28 AM
Thanks, I downloaded and installed GLEW and included the header. Now I get unresolved external linker errors. I've checked the gl.h file and it doesn't contain a glCreateShader function.

Alfonse Reinheart
05-16-2011, 12:30 AM
Of course it doesn't. When you use GLEW, you use glew.h, not gl.h. Did you read the directions (http://glew.sourceforge.net/basic.html)?

Tom Chesters
05-16-2011, 12:38 AM
Ok, sorry, I skimmed through the directions. I'm now only including glew.h and I'm still getting linker errors.

Actually I've just realised they are different.
Here is one.

unresolved external symbol __imp____glewUseProgram

I have got the GLEW dll in the system32 folder, the lib file in VC++'s lib folder, and the glew.h and wglew.h in the VC++'s include folder.

Alfonse Reinheart
05-16-2011, 02:01 AM
Did you actually link to the library? You know, have it listed in the "Linker/Input/Additional Dependencies" list of libraries to link with.

And it's generally bad form to fling .dlls into the system folder and .libs into Visual Studio's directories.

Tom Chesters
05-16-2011, 08:22 AM
Of course! I forgot to link the lib files. Anyway I was following the instructions on the site which are obviously for older versions of VC++. Anyway I've now sorted put all of the lib files and headers in a seperate folder, edited the project's "VC++ Directories" in it's settings, put the dll in the working directory, and linked to the lib files. There are no more errors. Thanks.

Nope sorry, I'm getting a runtime error saying no more than...
"Unhandled exception at 0x00000000 in Upgraded Engine.exe: 0xC0000005: Access violation."
This occurs when i use glCreateShader(GL_VERTEX_SHADER);
Forget about the runtime errors i fixed them. However the shader itself is just simply not doing anything, im still getting per vertex shading.

Nevermind again, it was faulty glsl, everything works now :D