setFunction(tmp);
}
void ShaderImage::setFunction(const std::string &source, ShaderInterface::Version reparse)
- {
+ {\r
+ glslversion = reparse;
switch(reparse) {
+ case ShaderInterface::THROUGH:
+ orig_source = source;
+ break;
case ShaderInterface::AUTO_DETECT:
case ShaderInterface::GLSL1_1:
ShaderInterface::reparseGLSL1_1(source, orig_source, orig_args);
void ShaderField::setFunction(const char* source, ShaderInterface::Version reparse)
{
std::string tmp(source);
- setFunction(tmp);
+ setFunction(tmp, reparse);
}
void ShaderField::setFunction(const std::string &source, ShaderInterface::Version reparse)
- {
+ {\r
+ glslversion = reparse;
switch(reparse) {
+ case ShaderInterface::THROUGH:
+ orig_source = source;
+ break;
case ShaderInterface::AUTO_DETECT:
case ShaderInterface::GLSL1_1:
ShaderInterface::reparseGLSL1_1(source, orig_source, orig_args);
}
void ShaderField::cache(DrawableWithCache &target)
{
- api.cacheField(orig_source, orig_args, target);
+ switch(glslversion) {
+ case ShaderInterface::THROUGH:
+ api.cache(orig_source, orig_args, target);
+ break;
+ case ShaderInterface::AUTO_DETECT:
+ case ShaderInterface::GLSL1_1:
+ api.cacheField(orig_source, orig_args, target);
+ break;
+ default:
+ api.cacheField(orig_source, orig_args, target);
+ break;
+ }
}
void ShaderField::cache(const char *source, DrawableWithCache &target)
{
class ShaderInterface {
public:
- enum Version { AUTO_DETECT, GLSL1_1 };
+ enum Version { THROUGH, AUTO_DETECT, GLSL1_1, GLSL3_3 };
static void reparseGLSL1_1(const std::string &source, std::string &result, std::vector<std::string> &args);
};
protected:
Shader api;
bool initialized;
- public:
+ public:\r
+ ShaderInterface::Version glslversion;
std::string orig_source;
std::vector<std::string> orig_args;
double arg_tmp[16];
Shader api;
bool initialized;
- public:
+ public:\r
+ ShaderInterface::Version glslversion;
std::string orig_source;
std::vector<std::string> orig_args;
double arg_tmp[16];
errormsg = logbuf;
delete [] logbuf;
throw new Exception(typeid(*this), "Shader compile failed", errormsg);
- }
+ }\r
+std::cout << final_source << std::endl;
\r
if(gl2Program==0) gl2Program = glCreateProgram();
glAttachShader(gl2Program, fragShader);
}
void ShaderAPI::cacheField(const std::string &orig_source, const std::vector<std::string> &vars, Drawable &target)
{
+ //std::string final_source = "#version 130\r\n#extension GL_EXT_gpu_shader4 : enable\r\n\r\n";
std::string final_source = "";
int mode = 0;