In an effort to not lock out OSX/Linux users from things I hope to create, I'm learning OpenGL, using C++ on Windows 8.1. I'm compiling with CL (MSVC++2013 update 3) from the command line, and using VS2013 for debugging. Unfortunately I am having problems even getting to a stage where I can put a few test vertices on screen.
My main problem has been that I keep getting the error "invalid enumerant" when I try to create a vertex shader like so:
auto id = glCreateShader(GL_VERTEX_SHADER);
My initialization code looks like this:
GLFWwindow *window;
if (!glfwInit())
return 0;
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
window = glfwCreateWindow(width, height, "My App", 0, 0);
if (!window)
{
glfwTerminate();
return 0;
}
glfwMakeContextCurrent(window);
glewExperimental = GL_TRUE;
int error = glewInit();
Here's a log dump from my console:
[Graphics] Vendor: NVIDIA Corporation
[Graphics] Renderer: GeForce GTX 670/PCIe/SSE2
[Graphics] Version: 4.1.0 NVIDIA 347.09
[Graphics] GLSL Version: 4.10 NVIDIA via Cg compiler
[Shaders] Compiling shader file: vs-default.glsl
[Shaders] Unable to create shader: invalid enumerant
- I have the latest driver from NVIDIA
- My video card supports up to version 4.5, but I have also tried setting 3.2, 3.3, 4.0, 4.1 and 4.4.
- I'm using GLFW3 and GLEW.
- I have glewExperimental = GL_TRUE right before glewInit().
- I have tried setting glewExperimental = GL_FALSE, to no avail
The opengl32.dll in my system32 folder has the following properties:
I found some old thread from 2011 without much in the way of help, but one person said that GLEW wasn't great with core profile stuff, though that's around three years out of date. Nevertheless, I tried using the glbinding project, but I was unable to get it to work with glfw, as glfw defines __gl_h_, which causes glbinding to break on compile, complaining that it's not compatible with __gl_h_, which I find strange given that the glbinding readme file cites glfw as one of the possible opengl libraries that it can be used with.
Anyway, I'm stuck. Roadblocked before I even got a chance to start doing anything with OpenGL. Any help would be appreciated.