I can't create a shader when trying to use shaders with sfml. The function glCreateShader(GL_VERTEX_SHADER); causes a segmentation fault. At first I googled it and found that it does that when the program does not have an opengl context. I tried SDL first but the poor documentation and "look at the header to know what to do" made me go for sfml
the code that causes the seg fault is bellow
sf::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL"); // Set color and depth clear value glClearDepth(1.f); glClearColor(0.f, 0.f, 0.f, 0.f); // Enable Z-buffer read and write glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); // Setup a perspective projection glMatrixMode(GL_PROJECTION); glLoadIdentity(); GLuint vertShader = glCreateShader(GL_VERTEX_SHADER); //...
I'm including glew, gl.h, sfml-window, sfml-system, using opengl 2.1 on gcc linux.
What is missing?