Linking with uncompiled shader in Ubuntu

后端 未结 1 2002
深忆病人
深忆病人 2021-01-28 19:01

I need to load a *.glsl to draw something. My environment is Ubuntu 13.04, hence it doesn\'t exist GLuint InitShader (GLuint, GLuint). It is my config for object creation, pre-l

相关标签:
1条回答
  • 2021-01-28 19:54
    const char *vertex_source = "./shader/vshader21.glsl";
                                 ^^^^^^^^^^^^^^^^^^^^^^^ wat
    glShaderSource (vertex_shader, 1, &vertex_source, NULL);
    

    glShaderSource() does not work that way!

    string: Specifies an array of pointers to strings containing the source code to be loaded into the shader.

    There's absolutely nothing in there about interpreting string as a filesystem path.

    You need to load the shader from file yourself, then pass the string(s) containing the shader code to glShaderSource().

    0 讨论(0)
提交回复
热议问题