mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
opengl: remove some errors, fix some animation bugs
This commit is contained in:
parent
173b28b6e6
commit
0a8c1f974e
@ -104,8 +104,13 @@ class OpenGLShader(
|
||||
renderWindow.renderSystem.shaders += this
|
||||
}
|
||||
|
||||
|
||||
private fun getUniformLocation(uniformName: String): Int {
|
||||
return glGetUniformLocation(shader, uniformName)
|
||||
val location = glGetUniformLocation(shader, uniformName)
|
||||
if (location < 0) {
|
||||
throw IllegalArgumentException("No uniform named$uniformName!")
|
||||
}
|
||||
return location
|
||||
}
|
||||
|
||||
override fun setFloat(uniformName: String, value: Float) {
|
||||
@ -151,7 +156,11 @@ class OpenGLShader(
|
||||
}
|
||||
|
||||
override fun setUniformBuffer(uniformName: String, uniformBuffer: OpenGLUniformBuffer) {
|
||||
glUniformBlockBinding(shader, glGetUniformBlockIndex(shader, uniformName), uniformBuffer.bindingIndex)
|
||||
val index = glGetUniformBlockIndex(shader, uniformName)
|
||||
if (index < 0) {
|
||||
throw IllegalArgumentException("No uniform buffer called $uniformName")
|
||||
}
|
||||
glUniformBlockBinding(shader, index, uniformBuffer.bindingIndex)
|
||||
}
|
||||
|
||||
fun unsafeUse() {
|
||||
|
@ -169,7 +169,7 @@ class OpenGLTextureArray(
|
||||
for ((level, data) in mipMaps.withIndex()) {
|
||||
val size = texture.size shr level
|
||||
|
||||
glTexSubImage3D(GL_TEXTURE_2D_ARRAY, level, 0, 0, renderData.index, size.x, size.y, level + 1, GL_RGBA, GL_UNSIGNED_BYTE, data)
|
||||
glTexSubImage3D(GL_TEXTURE_2D_ARRAY, level, 0, 0, renderData.index, size.x, size.y, 1, GL_RGBA, GL_UNSIGNED_BYTE, data)
|
||||
}
|
||||
|
||||
texture.data = null
|
||||
|
@ -11,7 +11,7 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
layout(std140) uniform uAnimationBuffer
|
||||
layout(std140) uniform uSpriteBuffer
|
||||
{
|
||||
uvec4 uAnimationData[ANIMATED_TEXTURE_COUNT];
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user