read the GL uniform locations
This commit is contained in:
parent
eed74a64f3
commit
9a483990a2
@ -158,6 +158,7 @@ Engine::Engine(const string & path, AV & av)
|
|||||||
|
|
||||||
registerLibraries();
|
registerLibraries();
|
||||||
|
|
||||||
|
{
|
||||||
const char *obj_v_src = (const char *) getFile("shaders/obj.vp", NULL);
|
const char *obj_v_src = (const char *) getFile("shaders/obj.vp", NULL);
|
||||||
const char *obj_f_src = (const char *) getFile("shaders/obj.fp", NULL);
|
const char *obj_f_src = (const char *) getFile("shaders/obj.fp", NULL);
|
||||||
const static guAttribBinding obj_bindings[] = {
|
const static guAttribBinding obj_bindings[] = {
|
||||||
@ -175,6 +176,17 @@ Engine::Engine(const string & path, AV & av)
|
|||||||
m_programs[PROG_OBJ] = 0;
|
m_programs[PROG_OBJ] = 0;
|
||||||
cerr << "Error: Could not obtain 'obj' shader sources" << endl;
|
cerr << "Error: Could not obtain 'obj' shader sources" << endl;
|
||||||
}
|
}
|
||||||
|
guUniformLocation uniforms_obj[] = {
|
||||||
|
{&m_uniforms_obj[UNIFORM_OBJ_AMBIENT], "ambient"},
|
||||||
|
{&m_uniforms_obj[UNIFORM_OBJ_DIFFUSE], "diffuse"},
|
||||||
|
{&m_uniforms_obj[UNIFORM_OBJ_SPECULAR], "specular"},
|
||||||
|
{&m_uniforms_obj[UNIFORM_OBJ_SHININESS], "shininess"},
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
guGetUniformLocations(m_programs[PROG_OBJ], uniforms_obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
const char *obj_tex_v_src =
|
const char *obj_tex_v_src =
|
||||||
(const char *) getFile("shaders/obj_tex.vp", NULL);
|
(const char *) getFile("shaders/obj_tex.vp", NULL);
|
||||||
const char *obj_tex_f_src =
|
const char *obj_tex_f_src =
|
||||||
@ -195,6 +207,14 @@ Engine::Engine(const string & path, AV & av)
|
|||||||
m_programs[PROG_OBJ_TEX] = 0;
|
m_programs[PROG_OBJ_TEX] = 0;
|
||||||
cerr << "Error: Could not obtain 'obj_tex' shader sources" << endl;
|
cerr << "Error: Could not obtain 'obj_tex' shader sources" << endl;
|
||||||
}
|
}
|
||||||
|
guUniformLocation uniforms_obj_tex[] = {
|
||||||
|
{&m_uniforms_obj_tex[UNIFORM_OBJ_TEX_AMBIENT], "ambient"},
|
||||||
|
{&m_uniforms_obj_tex[UNIFORM_OBJ_TEX_SPECULAR], "specular"},
|
||||||
|
{&m_uniforms_obj_tex[UNIFORM_OBJ_TEX_SHININESS], "shininess"},
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
guGetUniformLocations(m_programs[PROG_OBJ_TEX], uniforms_obj_tex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine::~Engine()
|
Engine::~Engine()
|
||||||
|
@ -372,8 +372,6 @@ class Engine
|
|||||||
enum { PROG_OBJ, PROG_OBJ_TEX, PROG_COUNT };
|
enum { PROG_OBJ, PROG_OBJ_TEX, PROG_COUNT };
|
||||||
GLuint m_programs[PROG_COUNT];
|
GLuint m_programs[PROG_COUNT];
|
||||||
enum {
|
enum {
|
||||||
UNIFORM_OBJ_PROJECTION,
|
|
||||||
UNIFORM_OBJ_MODELVIEW,
|
|
||||||
UNIFORM_OBJ_AMBIENT,
|
UNIFORM_OBJ_AMBIENT,
|
||||||
UNIFORM_OBJ_DIFFUSE,
|
UNIFORM_OBJ_DIFFUSE,
|
||||||
UNIFORM_OBJ_SPECULAR,
|
UNIFORM_OBJ_SPECULAR,
|
||||||
@ -387,8 +385,6 @@ class Engine
|
|||||||
};
|
};
|
||||||
GLint m_uniforms_obj[UNIFORM_OBJ_COUNT];
|
GLint m_uniforms_obj[UNIFORM_OBJ_COUNT];
|
||||||
enum {
|
enum {
|
||||||
UNIFORM_OBJ_TEX_PROJECTION,
|
|
||||||
UNIFORM_OBJ_TEX_MODELVIEW,
|
|
||||||
UNIFORM_OBJ_TEX_AMBIENT,
|
UNIFORM_OBJ_TEX_AMBIENT,
|
||||||
UNIFORM_OBJ_TEX_SPECULAR,
|
UNIFORM_OBJ_TEX_SPECULAR,
|
||||||
UNIFORM_OBJ_TEX_SHININESS,
|
UNIFORM_OBJ_TEX_SHININESS,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user