load_shader.h 752 B

12345678910111213141516171819202122232425262728293031323334
  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. #else
  11. #define GL_GLEXT_PROTOTYPES
  12. # include <GL/gl.h>
  13. # include <GL/glext.h>
  14. #endif
  15. namespace igl
  16. {
  17. // Creates and compiles a shader from a given string
  18. // Inputs:
  19. // src string containing GLSL shader code
  20. // type GLSL type of shader, one of:
  21. // GL_VERTEX_SHADER
  22. // GL_FRAGMENT_SHADER
  23. // GL_GEOMETRY_SHADER
  24. // Returns index id of the newly created shader, 0 on error
  25. IGL_INLINE GLuint load_shader(const char *src,const GLenum type);
  26. }
  27. #ifdef IGL_HEADER_ONLY
  28. # include "load_shader.cpp"
  29. #endif
  30. #endif