Always updating in use shader.

This commit is contained in:
Rinnegatamante
2020-10-21 23:30:02 +02:00
parent 9f267c904d
commit cf96e7d39e
+5 -5
View File
@@ -143,10 +143,10 @@ linkprogram(GLint vs, GLint fs, GLuint *program, bool is_2d)
char *log; char *log;
prog = glCreateProgram(); prog = glCreateProgram();
glAttachShader(prog, vs); glAttachShader(prog, vs);
glAttachShader(prog, fs); glAttachShader(prog, fs);
int stride = 0; int stride = 0;
int pos_size = is_2d ? 4 : 3; int pos_size = is_2d ? 4 : 3;
stride += vglBindPackedAttribLocation(prog, "in_pos" , pos_size, GL_FLOAT, stride, stride + sizeof(float) * pos_size) * (sizeof(float) * pos_size); stride += vglBindPackedAttribLocation(prog, "in_pos" , pos_size, GL_FLOAT, stride, stride + sizeof(float) * pos_size) * (sizeof(float) * pos_size);
@@ -155,7 +155,7 @@ linkprogram(GLint vs, GLint fs, GLuint *program, bool is_2d)
stride += vglBindPackedAttribLocation(prog, "in_tex0" , 2, GL_FLOAT, stride, stride + sizeof(float) * 2) * (sizeof(float) * 2); stride += vglBindPackedAttribLocation(prog, "in_tex0" , 2, GL_FLOAT, stride, stride + sizeof(float) * 2) * (sizeof(float) * 2);
stride += vglBindPackedAttribLocation(prog, "in_weights", 4, GL_FLOAT, stride, stride + sizeof(float) * 4) * (sizeof(float) * 4); stride += vglBindPackedAttribLocation(prog, "in_weights", 4, GL_FLOAT, stride, stride + sizeof(float) * 4) * (sizeof(float) * 4);
vglBindPackedAttribLocation(prog, "in_indices", 4, GL_UNSIGNED_BYTE, stride, stride + 4); vglBindPackedAttribLocation(prog, "in_indices", 4, GL_UNSIGNED_BYTE, stride, stride + 4);
glLinkProgram(prog); glLinkProgram(prog);
*program = prog; *program = prog;
@@ -235,10 +235,10 @@ Shader::create(const char **vsrc, const char **fsrc, bool is_2d)
void void
Shader::use(void) Shader::use(void)
{ {
if(currentShader != this){ //if(currentShader != this){
glUseProgram(this->program); glUseProgram(this->program);
currentShader = this; currentShader = this;
} //}
} }
void void