Allow texture to be NULL.
Some checks failed
Build Dusk / run-tests (push) Failing after 14s
Build Dusk / build-linux (push) Failing after 20s
Build Dusk / build-psp (push) Failing after 16s
Build Dusk / build-gamecube (push) Failing after 18s
Build Dusk / build-wii (push) Failing after 19s
Some checks failed
Build Dusk / run-tests (push) Failing after 14s
Build Dusk / build-linux (push) Failing after 20s
Build Dusk / build-psp (push) Failing after 16s
Build Dusk / build-gamecube (push) Failing after 18s
Build Dusk / build-wii (push) Failing after 19s
This commit is contained in:
@@ -33,9 +33,6 @@ errorret_t displayOpenGLInit(void) {
|
||||
errorChain(errorGLCheck());
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
errorChain(errorGLCheck());
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
|
||||
|
||||
errorOk();
|
||||
}
|
||||
@@ -141,13 +141,13 @@ errorret_t meshDrawGL(
|
||||
MESH_VERTEX_UV_SIZE,
|
||||
GL_FLOAT,
|
||||
stride,
|
||||
(const GLvoid*)&mesh->vertices[offset].uv
|
||||
(const GLvoid*)&mesh->vertices[offset].uv[0]
|
||||
);
|
||||
glVertexPointer(
|
||||
MESH_VERTEX_POS_SIZE,
|
||||
GL_FLOAT,
|
||||
stride,
|
||||
(const GLvoid*)&mesh->vertices[offset].pos
|
||||
(const GLvoid*)&mesh->vertices[offset].pos[0]
|
||||
);
|
||||
|
||||
// Shader may have model matrix here
|
||||
@@ -155,7 +155,8 @@ errorret_t meshDrawGL(
|
||||
errorChain(shaderLegacyMatrixUpdate());
|
||||
#endif
|
||||
|
||||
glDrawArrays(mesh->primitiveType, offset, count);
|
||||
// glDrawArrays(mesh->primitiveType, offset, count);
|
||||
glDrawArrays(mesh->primitiveType, 0, count);
|
||||
errorChain(errorGLCheck());
|
||||
#else
|
||||
// Modern VAO/VBO rendering
|
||||
@@ -183,5 +184,6 @@ errorret_t meshDisposeGL(meshgl_t *mesh) {
|
||||
glDeleteVertexArrays(1, &mesh->vaoId);
|
||||
errorChain(errorGLCheck());
|
||||
#endif
|
||||
|
||||
errorOk();
|
||||
}
|
||||
@@ -209,15 +209,31 @@ errorret_t shaderSetTextureGL(
|
||||
texture_t *texture
|
||||
) {
|
||||
assertNotNull(shader, "Shader cannot be null");
|
||||
assertNotNull(texture, "Texture cannot be null");
|
||||
assertStrLenMin(name, 1, "Uniform name cannot be empty");
|
||||
|
||||
#ifdef DUSK_OPENGL_LEGACY
|
||||
if(texture == NULL) {
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
errorChain(errorGLCheck());
|
||||
errorOk();
|
||||
}
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
errorChain(errorGLCheck());
|
||||
glBindTexture(GL_TEXTURE_2D, texture->id);
|
||||
errorChain(errorGLCheck());
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
errorChain(errorGLCheck());
|
||||
|
||||
#else
|
||||
if(texture == NULL) {
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
errorChain(errorGLCheck());
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
errorChain(errorGLCheck());
|
||||
errorOk();
|
||||
}
|
||||
|
||||
GLint location;
|
||||
errorChain(shaderParamGetLocationGL(shader, name, &location));
|
||||
|
||||
@@ -253,27 +269,6 @@ errorret_t shaderSetTextureGL(
|
||||
errorOk();
|
||||
}
|
||||
|
||||
// errorret_t shaderSetColorGL(
|
||||
// shadergl_t *shader,
|
||||
// const char_t *name,
|
||||
// color_t color
|
||||
// ) {
|
||||
// assertNotNull(shader, "Shader cannot be null");
|
||||
// assertStrLenMin(name, 1, "Uniform name cannot be empty");
|
||||
|
||||
// #ifdef DUSK_OPENGL_LEGACY
|
||||
// assertUnreachable("Cannot set colors on legacy opengl.");
|
||||
// #else
|
||||
// GLint location;
|
||||
// errorChain(shaderParamGetLocationGL(shader, name, &location));
|
||||
|
||||
// glUniform4f(location, color.r, color.g, color.b, color.a);
|
||||
// errorChain(errorGLCheck());
|
||||
// #endif
|
||||
|
||||
// errorOk();
|
||||
// }
|
||||
|
||||
errorret_t shaderBindGL(shadergl_t *shader) {
|
||||
#ifdef DUSK_OPENGL_LEGACY
|
||||
assertNotNull(shader, "Cannot bind a null shader.");
|
||||
|
||||
Reference in New Issue
Block a user