10        const static char* path = 
"/";
 
   12        const char* source = src.c_str();
 
   14        GLuint shader = glCreateShader(type);
 
   15        glShaderSource(shader, 1, &source, 0);
 
   16        glCompileShaderIncludeARB(shader, 1, &path, 0);
 
   21        glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
 
   24            glGetShaderInfoLog(shader, 2048, NULL, infoLog);
 
   25            printf(
"Shader Compiling Error:\n%s\n", infoLog);
 
 
   38        GLuint shader = glCreateShader(type);
 
   40        glShaderBinary(1, &shader, GL_SHADER_BINARY_FORMAT_SPIR_V, src, len);
 
   41        glSpecializeShader(shader, 
"main", 0, 0, 0);
 
   46        glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
 
   49            glGetShaderInfoLog(shader, 2048, NULL, infoLog);
 
   50            printf(
"Shader Compiling Error:\n%s\n", infoLog);
 
 
   63        std::ifstream ifs(file);
 
   64        std::string content((std::istreambuf_iterator<char>(ifs)),
 
   65            (std::istreambuf_iterator<char>()));
 
   66        const char* source = content.c_str();
 
   71        printf(
"Failed to compile shader from file: %s\n", file.c_str());
 
 
   83        id = GL_INVALID_INDEX;
 
 
   89        id = glCreateProgram();
 
 
   97        id = GL_INVALID_INDEX;
 
 
  102        glAttachShader(
id, shader.
id);
 
 
  110        GLchar infoLog[2048];
 
  111        glGetProgramiv(
id, GL_LINK_STATUS, &success);
 
  113            glGetProgramInfoLog(
id, 2048, NULL, infoLog);
 
  114            printf(
"Shader Program Linking Error:\n%s\n", infoLog);
 
 
  128        GLuint location = glGetUniformLocation(
id, name);
 
  129        glUniform1f(location, v);
 
 
  134        GLuint location = glGetUniformLocation(
id, name);
 
  135        glUniform1i(location, v);
 
 
  140        GLuint location = glGetUniformLocation(
id, name);
 
  141        glUniform2f(location, v[0], v[1]);
 
 
  146        GLuint location = glGetUniformLocation(
id, name);
 
  147        glUniform3f(location, v[0], v[1], v[2]);
 
 
  152        GLuint location = glGetUniformLocation(
id, name);
 
  153        glUniform4f(location, v[0], v[1], v[2], v[3]);
 
 
  171                printf(
"Failed to compile shader: %s\n", vs);
 
  179                printf(
"Failed to compile shader: %s\n", fs);
 
  187                printf(
"Failed to compile shader: %s\n", gs);
 
  190        if (!program->
link())
 
  192            printf(
"Failed to link shader program: %s\n", fs);
 
 
  203        const void* vs, 
size_t vs_len,
 
  204        const void* fs, 
size_t fs_len,
 
  205        const void* gs, 
size_t gs_len)
 
  219                printf(
"Failed to compile shader: %s\n", vs);
 
  227                printf(
"Failed to compile shader: %s\n", fs);
 
  235                printf(
"Failed to compile shader: %s\n", gs);
 
  238        if (!program->
link())
 
  240            printf(
"Failed to link shader program: %s\n", fs);
 
 
void setFloat(const char *name, float v)
 
static Program * createProgramSPIRV(const void *vs, size_t vs_len, const void *fs, size_t fs_len, const void *gs=0, size_t gs_len=0)
 
void setVec2(const char *name, dyno::Vec2f v)
 
static Program * createProgram(const char *vs, const char *fs, const char *gs=0)
 
void setInt(const char *name, int v)
 
void setVec4(const char *name, dyno::Vec4f v)
 
void setVec3(const char *name, dyno::Vec3f v)
 
void attachShader(const Shader &shader)
 
bool createFromSPIRV(unsigned int type, const void *spirv, const size_t len)
 
bool createFromFile(unsigned int type, const std::string &path)
 
bool createFromSource(unsigned int type, const std::string &src)
 
This is an implementation of AdditiveCCD based on peridyno.