Problem doing glCreateShader error 0x500 - invalid enum

Started by
2 comments, last by gzaloprgm 13 years, 4 months ago
Hi, I'm having a weird problem using GLEE and GLFW. I am creating an opengl 3.3 context, and trying to use every function of it with GLEE.

This is my code

#include <GL/glee.h>#include <GL/glfw.h>#include <stdio.h>int main(){	if (!glfwInit()){		printf("Error initializing GLFW\n");		return -1;	}	glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);	glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);	if(glfwOpenWindow(800,600,8,8,8,8,0,0, GLFW_WINDOW) != GL_TRUE) {		glfwTerminate();		printf("Error creating window\n");		return -1;	}		printf("Window created OK, OpenGL %d.%d\n", glfwGetWindowParam(GLFW_OPENGL_VERSION_MAJOR), glfwGetWindowParam(GLFW_OPENGL_VERSION_MINOR));		GLuint vertexId, pixelId;		printf("%x ", glGetError());	vertexId = glCreateShader(GL_VERTEX_SHADER);	printf("%x ", glGetError());	pixelId = glCreateShader(GL_FRAGMENT_SHADER);	printf("%x ", glGetError());		bool running = true;		while(running){		glViewport(0, 0, 800, 600); 		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);			glfwSwapBuffers();		running = !glfwGetKey( GLFW_KEY_ESC ) && glfwGetWindowParam( GLFW_OPENED );	}	glfwTerminate();	return 0;}


When I run it, the first glGetError() shows 0 (as expected), but the 2nd and 3rd show 0x500 (INVALID_ENUM)

This is kinda weird since glCreateShader shouldn't return that unless GL_VERTEX_SHADER definition was wrong, which I think it isn't.

If I change the context to 2.x, it works perfectly

Does anybody have a clue regarding why that is happening? Is it an incompatibility between glfw and glee?

My compiler line is g++ test.cpp -o test.exe -lglfw -lglee -lopengl32

Thanks,
Gonzalo

[Edited by - gzaloprgm on December 9, 2010 8:41:31 PM]
In tangent space no one can hear you scream
Advertisement
I found the bug, I should have read GLEE documentation a bit more, specially the part that says

Core functions up to OpenGL 3.0

Trying to use shader functions in OpenGL 3.3 was what made that error.
In tangent space no one can hear you scream
That's weird. GLEE must be doing some weird stuff.
Use GLEW instead.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
GLEW works better, but it still has a major bug: you need to use the compatibility profile or otherwise it hangs...

glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE);

http://sourceforge.net/tracker/?func=detail&atid=523274&aid=2927731&group_id=67586

Cheers,
Gonzalo
In tangent space no one can hear you scream

This topic is closed to new replies.

Advertisement