12345678910111213141516171819202122232425262728293031323334 |
- #include "load_shader.h"
- #include "print_shader_info_log.h"
- #include <cstdio>
- IGL_INLINE GLuint igl::opengl::load_shader(
- const std::string & src,const GLenum type)
- {
- if(src.empty())
- {
- return (GLuint) 0;
- }
- GLuint s = glCreateShader(type);
- if(s == 0)
- {
- fprintf(stderr,"Error: load_shader() failed to create shader.\n");
- return 0;
- }
-
- const char *c = src.c_str();
- glShaderSource(s, 1, &c, NULL);
- glCompileShader(s);
-
- igl::opengl::print_shader_info_log(s);
- return s;
- }
|