Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: segmentation-fault in glCreateShader(GL_VERTEX_SHADER) ...

  1. #1
    Intern Contributor
    Join Date
    Jul 2013
    Posts
    62

    segmentation-fault in glCreateShader(GL_VERTEX_SHADER) ...

    Hi all,
    I've had some steeple-chase moving my code to GLEW & GLFW. Loading the shaders from file was a particular hassle. The coding compiles without errors, but it generates a segmemntationfault on execution when calling
    vertShader = glCreateShader(GL_VERTEX_SHADER);
    when I tab through the lines debugging.

    dgb, mingw, win7.

    any suggestions ?
    I cannot yet use 'glext_ARB_debug_output' .. should I look for function-pointers to load that applies to the situation?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,104
    Make sure you have initialized your OpenGL context

  3. #3
    Intern Contributor
    Join Date
    Jul 2013
    Posts
    62
    Hi Tonyo
    Can you throw a bone of code or better, point to an appropriate source of info?
    As said I try to use GLEW & GLFW. The GLFW userguide shows a minimal program with a window. How can that come by without a context created somewhere BEHIND the scene?
    I entered a new setup with GLEW and GLFW3, and that GLFW3 has atleast some makeContextCurrent() - but - I have not been able to get GLEW going there and GLFW/GLFW3 gets initiated .. but none of it's functions works anyway (neither new or old). I've probably been linking to the wrong libraries, so I've thrown some attention to MinGW and Code::Blocks.

    I've found some MinGW-compatible libraries and a post about some of MinGW's shortcommings as for MSVC-generated libs - but havn't tried it out yet. I'm hopefull.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,104
    GLEW has an init call glewInit() that you call after you have created your window with GLFW but before you do anything else. It creates the jump table for all function other than those defined in OpenGL 1.1

  5. #5
    Intern Contributor
    Join Date
    Jul 2013
    Posts
    62
    Hi Tonyo,
    I finally got glew and glfw3 working and has started testing my code. Alas .. it looks really good ;o)

  6. #6
    Intern Contributor
    Join Date
    Jul 2013
    Posts
    62
    dooo ..
    The exact same problem exists.
    I think that I'll need to compile GLEW on MinGW/Code::Blocks .. the compiled version of glfw3 is a 'special' lib-mingw version, but the GLEW is not. Just cann't get there without knowing wtf I'm doing.

  7. #7
    Intern Contributor
    Join Date
    Jul 2013
    Posts
    62
    Hi all,
    I followed another thread an read that GLFW3 should be initiated before GLEW. That made a difference. The shaders now compile and link to the program apparently without errors ( glGetError() ). [That was exactly what you told me Tonyo. When will I ever learn to read]
    The following call to
    glGenVertexArrays(1, &vao);
    now seems to be a new culprit.
    I have no idea why it generates a segmentation-fault.

    I realize that this question no longer (ever did) apply to 'shader language'. Bear with me.
    Last edited by CarstenT; 11-23-2013 at 08:08 AM.

  8. #8
    Intern Contributor
    Join Date
    Jul 2013
    Posts
    62
    glewExperimental = GL_TRUE ;
    did the trick.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •