I'd like to create a simple tool to test my shaders. It should try to compile them, and output any messages from the driver. However, I'm having trouble: it segfaults. This is the code:
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/gl.h>
/* Test shader */
static const GLchar * vertexSource =
"#version 150 core\n"
"in vec2 position;"
"in vec3 color;"
"out vec3 Color;"
"void main() {"
" Color = color;"
" gl_Position = vec4(position, 0.0, 1.0);"
"}";
int main(void)
{
GLuint vertexShader;
glewExperimental = GL_TRUE;
glewInit();
vertexShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertexShader, 1, &vertexSource, NULL);
glCompileShader(vertexShader);
glDeleteShader(vertexShader);
return EXIT_SUCCESS;
}
No other messages other than Segmentation fault are emitted. Can anyone explain what is happening?
P.S.: FWIW, I'm using the R600g Mesa (10.0) driver on a Radeon HD 3200, GCC version 4.8.2.