Jump to content
  • Advertisement
Sign in to follow this  
gzaloprgm

OpenGL Problem doing glCreateShader error 0x500 - invalid enum

This topic is 2842 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

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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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!