Reputation: 45
I am writing C++ program with use of glew,glut and GLM. When I am creating shader like this:
GLuint VertexShaderID = glCreateShader(GL_VERTEX_SHADER);
it says "Segmentation fault(core dumped)".
My hardware is Intel Atom CPU.
OS:OpenSuse 13.2 32-bit.
What I need to do to make it work?
Upvotes: 1
Views: 826
Reputation: 1836
You're not checking OpenGL extensions, version, or etc.
GLenum err = glewInit();
if (err != GLEW_OK)
exit(1); // or handle the error in a nicer way
if (!GLEW_VERSION_2_1) // check that the machine supports the 2.1 API.
exit(1); // or handle the error in a nicer way
This code needs to happen after creating the OpenGL context, but before using any potentially-not-existing functions. More details on the GLEW web page
Upvotes: 2