|
@@ -14,6 +14,7 @@
|
|
|
#include <cstdio>
|
|
|
|
|
|
IGL_INLINE bool igl::create_shader_program(
|
|
|
+ const std::string & geom_source,
|
|
|
const std::string & vert_source,
|
|
|
const std::string & frag_source,
|
|
|
const std::map<std::string,GLuint> & attrib,
|
|
@@ -36,6 +37,18 @@ IGL_INLINE bool igl::create_shader_program(
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ if(geom_source != "")
|
|
|
+ {
|
|
|
+ // load vertex shader
|
|
|
+ GLuint g = igl::load_shader(geom_source.c_str(),GL_GEOMETRY_SHADER_EXT);
|
|
|
+ if(g == 0)
|
|
|
+ {
|
|
|
+ cerr<<"geometry shader failed to compile."<<endl;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ glAttachShader(id,g);
|
|
|
+ }
|
|
|
+
|
|
|
if(vert_source != "")
|
|
|
{
|
|
|
// load vertex shader
|
|
@@ -80,6 +93,27 @@ IGL_INLINE bool igl::create_shader_program(
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+IGL_INLINE bool igl::create_shader_program(
|
|
|
+ const std::string & vert_source,
|
|
|
+ const std::string & frag_source,
|
|
|
+ const std::map<std::string,GLuint> & attrib,
|
|
|
+ GLuint & prog_id)
|
|
|
+{
|
|
|
+ return create_shader_program("",vert_source,frag_source,attrib,prog_id);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+IGL_INLINE GLuint igl::create_shader_program(
|
|
|
+ const std::string & geom_source,
|
|
|
+ const std::string & vert_source,
|
|
|
+ const std::string & frag_source,
|
|
|
+ const std::map<std::string,GLuint> & attrib)
|
|
|
+{
|
|
|
+ GLuint prog_id = 0;
|
|
|
+ create_shader_program(geom_source,vert_source,frag_source,attrib,prog_id);
|
|
|
+ return prog_id;
|
|
|
+}
|
|
|
+
|
|
|
IGL_INLINE GLuint igl::create_shader_program(
|
|
|
const std::string & vert_source,
|
|
|
const std::string & frag_source,
|
|
@@ -89,4 +123,5 @@ IGL_INLINE GLuint igl::create_shader_program(
|
|
|
create_shader_program(vert_source,frag_source,attrib,prog_id);
|
|
|
return prog_id;
|
|
|
}
|
|
|
+
|
|
|
#endif
|