load_shader.h 792 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef IGL_LOAD_SHADER_H
  2. #define IGL_LOAD_SHADER_H
  3. #include "igl_inline.h"
  4. #ifdef __APPLE__
  5. # include <OpenGL/gl.h>
  6. #elif defined(_WIN32)
  7. # define NOMINMAX
  8. # include <Windows.h>
  9. # undef NOMINMAX
  10. # include <GL/glew.h>
  11. # include <GL/gl.h>
  12. #else
  13. # define GL_GLEXT_PROTOTYPES
  14. # include <GL/gl.h>
  15. # include <GL/glext.h>
  16. #endif
  17. namespace igl
  18. {
  19. // Creates and compiles a shader from a given string
  20. // Inputs:
  21. // src string containing GLSL shader code
  22. // type GLSL type of shader, one of:
  23. // GL_VERTEX_SHADER
  24. // GL_FRAGMENT_SHADER
  25. // GL_GEOMETRY_SHADER
  26. // Returns index id of the newly created shader, 0 on error
  27. IGL_INLINE GLuint load_shader(const char *src,const GLenum type);
  28. }
  29. #ifdef IGL_HEADER_ONLY
  30. # include "load_shader.cpp"
  31. #endif
  32. #endif