load_shader.h 769 B

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