#pragma once
#include <string>
#include <time.h>
#include "Common/GPU/OpenGL/GLCommon.h"
struct GLSLProgram {
char name[16];
char vshader_filename[256];
char fshader_filename[256];
const char *vshader_source;
const char *fshader_source;
time_t vshader_mtime;
time_t fshader_mtime;
GLint sampler0;
GLint sampler1;
GLint u_worldviewproj;
GLint u_world;
GLint u_viewproj;
GLint u_fog;
GLint u_sundir;
GLint u_camerapos;
GLint a_position;
GLint a_color;
GLint a_normal;
GLint a_texcoord0;
GLint a_texcoord1;
GLuint vsh_;
GLuint fsh_;
GLuint program_;
};
GLSLProgram *glsl_create(const char *vshader_file, const char *fshader_file, std::string *error_message = 0);
GLSLProgram *glsl_create_source(const char *vshader_src, const char *fshader_src, std::string *error_message = 0);
void glsl_destroy(GLSLProgram *program);
bool glsl_recompile(GLSLProgram *program, std::string *error_message = 0);
void glsl_bind(const GLSLProgram *program);
const GLSLProgram *glsl_get_program();
void glsl_unbind();
int glsl_attrib_loc(const GLSLProgram *program, const char *name);
int glsl_uniform_loc(const GLSLProgram *program, const char *name);