I’ve been developing opengl on this machine for a while now, and suddenly, GLEW reports i don’t have the extensions needed to get opengl glsl running, even though it works in other projects. The funny part is, i even get
OpenGL Vendor: NVIDIA Corporation
OpenGL Renderer: GeForce 610M/PCIe/SSE2
OpenGL Version: 3.3.0
OpenGL 2.0 is available!
[FAILED] OpenGL Shading Language is not available...
I use glsllib 0.9.4 to load the extensions, which in turn uses GLEW. My code is as follows:
bool Jogo::init() {
if(glfwInit() != GL_TRUE) return false;
glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE, GL_TRUE);
if(glfwOpenWindow(1024, 768, 0, 0, 0, 0, 32, 0, GLFW_WINDOW) != GL_TRUE) return false;
glewExperimental = true;
if(initGLExtensions() != true) return false;
glm::mat4 matrizModel = glm::mat4(1.0f);
glm::mat4 matrizView = glm::lookAt(glm::vec3(0, 0, 3), glm::vec3(0, 0, 0), glm::vec3(0, 1, 0));
glm::mat4 matrizProjecao = glm::perspective(45.0f, 9.0f/16.0f, -1.0f, 1.0f);
m_matrizMVP = matrizProjecao * matrizView * matrizModel;
m_shader = m_gerenciadorShader.loadfromFile("vshader.glsl", "fshader.glsl");
char *x = m_shader->getLinkerLog();
m_shader->setUniformMatrix4fv("mvp", 1, GL_FALSE, &(m_matrizMVP[0][0]));
m_world = new World();
glClearColor(0.0f, 0.2f, 0.5f, 0.0f);
glClearDepth(0.0f);
return true;
}
glsllib’s code to load extensions is:
bool GLSLAPI initGLExtensions(void) {
if (extensions_init) return true;
extensions_init = true;
GLenum err = glewInit();
if (GLEW_OK != err) {
cout << "Error:" << glewGetErrorString(err) << endl;
extensions_init = false;
return false;
}
cout << "OpenGL Vendor: " << (char*) glGetString(GL_VENDOR) << "\n";
cout << "OpenGL Renderer: " << (char*) glGetString(GL_RENDERER) << "\n";
cout << "OpenGL Version: " << (char*) glGetString(GL_VERSION) << "\n\n";
checkGLSL();
return true;
}
Where CheckGLSL looks for glewGetExtension("GL_ARB_fragment_shader") and glewGetExtension("GL_ARB_vertex_shader") to see if GLSL is supported.
P.S. If i remove glewExperimental, the code crashes on glGenVertexArrays.
Unfortunately GLEW is not really on par with current OpenGL development, especially if core context or explicit version profiles are involved. Only recently I had quite the same issue, also in conjunction with GLFW. Omitting to set the OpenGL version window hints did resolve the issue for me then. I.e. disable or remove those two calls: