/**
  Simple GLSL shader interface.
  
  Relies on GLEW internally to access OpenGL extensions.
  
  Dr. Orion Sky Lawlor, olawlor@acm.org, 2008-02-14 (public domain)
*/
#ifndef __OSL_GLSL_H
#define __OSL_GLSL_H

// Create a complete shader object from these chunks of GLSL shader code.
//  You still need to glUseProgramObjectARB(return value);
GLhandleARB makeProgramObject(const char *vertex,const char *fragment);

// Create a complete shader object from these GLSL files.
GLhandleARB makeProgramObjectFromFiles(const char *vFile="vertex.txt",
	const char *fFile="fragment.txt");

// Set this uniform float to this value
inline void setUniform(GLhandleARB prog,const char *name,float value) {
	glUniform1fARB(glGetUniformLocationARB(prog,name),value);
}
inline void setUniform(GLhandleARB prog,const char *name,double value) {
	setUniform(prog,name,(float)value);
}
// Set this uniform int to this value
inline void setUniform(GLhandleARB prog,const char *name,int value) {
	glUniform1iARB(glGetUniformLocationARB(prog,name),value);
}
#ifdef __OSL_VEC4_H
inline void setUniform(GLhandleARB prog,const char *name,const vec3 &value) {
	glUniform3fvARB(glGetUniformLocationARB(prog,name),1,value);
}
inline void setUniform(GLhandleARB prog,const char *name,const vec4 &value) {
	glUniform4fvARB(glGetUniformLocationARB(prog,name),1,value);
}
#endif

#endif
