fix GL program used
parent
9f691169f4
commit
0f328384b2
2
depot
2
depot
|
@ -1 +1 @@
|
||||||
Subproject commit 15cce740439eda67c945f9d4354e2868340a567e
|
Subproject commit 9a430a960a8e622a7b38fb314fa543a8f94399e4
|
|
@ -598367,7 +598367,6 @@ typedef struct iqm_vertex {
|
||||||
|
|
||||||
typedef struct iqm_t {
|
typedef struct iqm_t {
|
||||||
int nummeshes, numtris, numverts, numjoints, numframes, numanims;
|
int nummeshes, numtris, numverts, numjoints, numframes, numanims;
|
||||||
GLuint program;
|
|
||||||
GLuint vao, ibo, vbo;
|
GLuint vao, ibo, vbo;
|
||||||
GLuint *textures;
|
GLuint *textures;
|
||||||
uint8_t *buf, *meshdata, *animdata;
|
uint8_t *buf, *meshdata, *animdata;
|
||||||
|
@ -598381,7 +598380,6 @@ typedef struct iqm_t {
|
||||||
vec4 *colormaps;
|
vec4 *colormaps;
|
||||||
} iqm_t;
|
} iqm_t;
|
||||||
|
|
||||||
#define program (q->program)
|
|
||||||
#define meshdata (q->meshdata)
|
#define meshdata (q->meshdata)
|
||||||
#define animdata (q->animdata)
|
#define animdata (q->animdata)
|
||||||
#define nummeshes (q->nummeshes)
|
#define nummeshes (q->nummeshes)
|
||||||
|
@ -598913,7 +598911,7 @@ model_t model_from_mem(const void *mem, int len, int flags) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
iqm_t *q = CALLOC(1, sizeof(iqm_t));
|
iqm_t *q = CALLOC(1, sizeof(iqm_t));
|
||||||
program = shaderprog;
|
m.program = shaderprog;
|
||||||
|
|
||||||
int error = 1;
|
int error = 1;
|
||||||
if( ptr && len ) {
|
if( ptr && len ) {
|
||||||
|
@ -598956,9 +598954,6 @@ model_t model_from_mem(const void *mem, int len, int flags) {
|
||||||
m.num_frames = numframes;
|
m.num_frames = numframes;
|
||||||
m.iqm = q;
|
m.iqm = q;
|
||||||
m.curframe = model_animate(m, 0);
|
m.curframe = model_animate(m, 0);
|
||||||
#undef program
|
|
||||||
m.program = (q->program);
|
|
||||||
#define program (q->program)
|
|
||||||
|
|
||||||
//m.num_textures = nummeshes; // assume 1 texture only per mesh
|
//m.num_textures = nummeshes; // assume 1 texture only per mesh
|
||||||
#undef textures
|
#undef textures
|
||||||
|
@ -599164,13 +599159,13 @@ void model_draw_call(model_t m) {
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, textures[i] );
|
glBindTexture(GL_TEXTURE_2D, textures[i] );
|
||||||
glUniform1i(glGetUniformLocation(program, "fsDiffTex"), 0 /*<-- unit!*/ );
|
glUniform1i(glGetUniformLocation(m.program, "fsDiffTex"), 0 /*<-- unit!*/ );
|
||||||
|
|
||||||
int loc;
|
int loc;
|
||||||
if ((loc = glGetUniformLocation(program, "u_textured")) >= 0) {
|
if ((loc = glGetUniformLocation(m.program, "u_textured")) >= 0) {
|
||||||
bool textured = !!textures[i] && textures[i] != texture_checker().id; // m.materials[i].layer[0].texture != texture_checker().id;
|
bool textured = !!textures[i] && textures[i] != texture_checker().id; // m.materials[i].layer[0].texture != texture_checker().id;
|
||||||
glUniform1i(loc, textured ? GL_TRUE : GL_FALSE);
|
glUniform1i(loc, textured ? GL_TRUE : GL_FALSE);
|
||||||
if ((loc = glGetUniformLocation(program, "u_diffuse")) >= 0) {
|
if ((loc = glGetUniformLocation(m.program, "u_diffuse")) >= 0) {
|
||||||
glUniform4f(loc, m.materials[i].layer[0].color.r, m.materials[i].layer[0].color.g, m.materials[i].layer[0].color.b, m.materials[i].layer[0].color.a);
|
glUniform4f(loc, m.materials[i].layer[0].color.r, m.materials[i].layer[0].color.g, m.materials[i].layer[0].color.b, m.materials[i].layer[0].color.a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -599202,7 +599197,7 @@ void model_render_instanced(model_t m, mat44 proj, mat44 view, mat44* models, in
|
||||||
model_set_state(m);
|
model_set_state(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
model_set_uniforms(m, shader > 0 ? shader : program, mv, proj, view, models[0]);
|
model_set_uniforms(m, shader > 0 ? shader : m.program, mv, proj, view, models[0]);
|
||||||
model_draw_call(m);
|
model_draw_call(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3828,7 +3828,6 @@ typedef struct iqm_vertex {
|
||||||
|
|
||||||
typedef struct iqm_t {
|
typedef struct iqm_t {
|
||||||
int nummeshes, numtris, numverts, numjoints, numframes, numanims;
|
int nummeshes, numtris, numverts, numjoints, numframes, numanims;
|
||||||
GLuint program;
|
|
||||||
GLuint vao, ibo, vbo;
|
GLuint vao, ibo, vbo;
|
||||||
GLuint *textures;
|
GLuint *textures;
|
||||||
uint8_t *buf, *meshdata, *animdata;
|
uint8_t *buf, *meshdata, *animdata;
|
||||||
|
@ -3842,7 +3841,6 @@ typedef struct iqm_t {
|
||||||
vec4 *colormaps;
|
vec4 *colormaps;
|
||||||
} iqm_t;
|
} iqm_t;
|
||||||
|
|
||||||
#define program (q->program)
|
|
||||||
#define meshdata (q->meshdata)
|
#define meshdata (q->meshdata)
|
||||||
#define animdata (q->animdata)
|
#define animdata (q->animdata)
|
||||||
#define nummeshes (q->nummeshes)
|
#define nummeshes (q->nummeshes)
|
||||||
|
@ -4374,7 +4372,7 @@ model_t model_from_mem(const void *mem, int len, int flags) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
iqm_t *q = CALLOC(1, sizeof(iqm_t));
|
iqm_t *q = CALLOC(1, sizeof(iqm_t));
|
||||||
program = shaderprog;
|
m.program = shaderprog;
|
||||||
|
|
||||||
int error = 1;
|
int error = 1;
|
||||||
if( ptr && len ) {
|
if( ptr && len ) {
|
||||||
|
@ -4417,9 +4415,6 @@ model_t model_from_mem(const void *mem, int len, int flags) {
|
||||||
m.num_frames = numframes;
|
m.num_frames = numframes;
|
||||||
m.iqm = q;
|
m.iqm = q;
|
||||||
m.curframe = model_animate(m, 0);
|
m.curframe = model_animate(m, 0);
|
||||||
#undef program
|
|
||||||
m.program = (q->program);
|
|
||||||
#define program (q->program)
|
|
||||||
|
|
||||||
//m.num_textures = nummeshes; // assume 1 texture only per mesh
|
//m.num_textures = nummeshes; // assume 1 texture only per mesh
|
||||||
#undef textures
|
#undef textures
|
||||||
|
@ -4625,13 +4620,13 @@ void model_draw_call(model_t m) {
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, textures[i] );
|
glBindTexture(GL_TEXTURE_2D, textures[i] );
|
||||||
glUniform1i(glGetUniformLocation(program, "fsDiffTex"), 0 /*<-- unit!*/ );
|
glUniform1i(glGetUniformLocation(m.program, "fsDiffTex"), 0 /*<-- unit!*/ );
|
||||||
|
|
||||||
int loc;
|
int loc;
|
||||||
if ((loc = glGetUniformLocation(program, "u_textured")) >= 0) {
|
if ((loc = glGetUniformLocation(m.program, "u_textured")) >= 0) {
|
||||||
bool textured = !!textures[i] && textures[i] != texture_checker().id; // m.materials[i].layer[0].texture != texture_checker().id;
|
bool textured = !!textures[i] && textures[i] != texture_checker().id; // m.materials[i].layer[0].texture != texture_checker().id;
|
||||||
glUniform1i(loc, textured ? GL_TRUE : GL_FALSE);
|
glUniform1i(loc, textured ? GL_TRUE : GL_FALSE);
|
||||||
if ((loc = glGetUniformLocation(program, "u_diffuse")) >= 0) {
|
if ((loc = glGetUniformLocation(m.program, "u_diffuse")) >= 0) {
|
||||||
glUniform4f(loc, m.materials[i].layer[0].color.r, m.materials[i].layer[0].color.g, m.materials[i].layer[0].color.b, m.materials[i].layer[0].color.a);
|
glUniform4f(loc, m.materials[i].layer[0].color.r, m.materials[i].layer[0].color.g, m.materials[i].layer[0].color.b, m.materials[i].layer[0].color.a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4663,7 +4658,7 @@ void model_render_instanced(model_t m, mat44 proj, mat44 view, mat44* models, in
|
||||||
model_set_state(m);
|
model_set_state(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
model_set_uniforms(m, shader > 0 ? shader : program, mv, proj, view, models[0]);
|
model_set_uniforms(m, shader > 0 ? shader : m.program, mv, proj, view, models[0]);
|
||||||
model_draw_call(m);
|
model_draw_call(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
engine/v4k.c
15
engine/v4k.c
|
@ -16536,7 +16536,6 @@ typedef struct iqm_vertex {
|
||||||
|
|
||||||
typedef struct iqm_t {
|
typedef struct iqm_t {
|
||||||
int nummeshes, numtris, numverts, numjoints, numframes, numanims;
|
int nummeshes, numtris, numverts, numjoints, numframes, numanims;
|
||||||
GLuint program;
|
|
||||||
GLuint vao, ibo, vbo;
|
GLuint vao, ibo, vbo;
|
||||||
GLuint *textures;
|
GLuint *textures;
|
||||||
uint8_t *buf, *meshdata, *animdata;
|
uint8_t *buf, *meshdata, *animdata;
|
||||||
|
@ -16550,7 +16549,6 @@ typedef struct iqm_t {
|
||||||
vec4 *colormaps;
|
vec4 *colormaps;
|
||||||
} iqm_t;
|
} iqm_t;
|
||||||
|
|
||||||
#define program (q->program)
|
|
||||||
#define meshdata (q->meshdata)
|
#define meshdata (q->meshdata)
|
||||||
#define animdata (q->animdata)
|
#define animdata (q->animdata)
|
||||||
#define nummeshes (q->nummeshes)
|
#define nummeshes (q->nummeshes)
|
||||||
|
@ -17082,7 +17080,7 @@ model_t model_from_mem(const void *mem, int len, int flags) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
iqm_t *q = CALLOC(1, sizeof(iqm_t));
|
iqm_t *q = CALLOC(1, sizeof(iqm_t));
|
||||||
program = shaderprog;
|
m.program = shaderprog;
|
||||||
|
|
||||||
int error = 1;
|
int error = 1;
|
||||||
if( ptr && len ) {
|
if( ptr && len ) {
|
||||||
|
@ -17125,9 +17123,6 @@ model_t model_from_mem(const void *mem, int len, int flags) {
|
||||||
m.num_frames = numframes;
|
m.num_frames = numframes;
|
||||||
m.iqm = q;
|
m.iqm = q;
|
||||||
m.curframe = model_animate(m, 0);
|
m.curframe = model_animate(m, 0);
|
||||||
#undef program
|
|
||||||
m.program = (q->program);
|
|
||||||
#define program (q->program)
|
|
||||||
|
|
||||||
//m.num_textures = nummeshes; // assume 1 texture only per mesh
|
//m.num_textures = nummeshes; // assume 1 texture only per mesh
|
||||||
#undef textures
|
#undef textures
|
||||||
|
@ -17333,13 +17328,13 @@ void model_draw_call(model_t m) {
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, textures[i] );
|
glBindTexture(GL_TEXTURE_2D, textures[i] );
|
||||||
glUniform1i(glGetUniformLocation(program, "fsDiffTex"), 0 /*<-- unit!*/ );
|
glUniform1i(glGetUniformLocation(m.program, "fsDiffTex"), 0 /*<-- unit!*/ );
|
||||||
|
|
||||||
int loc;
|
int loc;
|
||||||
if ((loc = glGetUniformLocation(program, "u_textured")) >= 0) {
|
if ((loc = glGetUniformLocation(m.program, "u_textured")) >= 0) {
|
||||||
bool textured = !!textures[i] && textures[i] != texture_checker().id; // m.materials[i].layer[0].texture != texture_checker().id;
|
bool textured = !!textures[i] && textures[i] != texture_checker().id; // m.materials[i].layer[0].texture != texture_checker().id;
|
||||||
glUniform1i(loc, textured ? GL_TRUE : GL_FALSE);
|
glUniform1i(loc, textured ? GL_TRUE : GL_FALSE);
|
||||||
if ((loc = glGetUniformLocation(program, "u_diffuse")) >= 0) {
|
if ((loc = glGetUniformLocation(m.program, "u_diffuse")) >= 0) {
|
||||||
glUniform4f(loc, m.materials[i].layer[0].color.r, m.materials[i].layer[0].color.g, m.materials[i].layer[0].color.b, m.materials[i].layer[0].color.a);
|
glUniform4f(loc, m.materials[i].layer[0].color.r, m.materials[i].layer[0].color.g, m.materials[i].layer[0].color.b, m.materials[i].layer[0].color.a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17371,7 +17366,7 @@ void model_render_instanced(model_t m, mat44 proj, mat44 view, mat44* models, in
|
||||||
model_set_state(m);
|
model_set_state(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
model_set_uniforms(m, shader > 0 ? shader : program, mv, proj, view, models[0]);
|
model_set_uniforms(m, shader > 0 ? shader : m.program, mv, proj, view, models[0]);
|
||||||
model_draw_call(m);
|
model_draw_call(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue