Skip to content

Commit 3482454

Browse files
committed
Fix 1.8 errors
1 parent 8c9339f commit 3482454

File tree

1 file changed

+17
-7
lines changed
  • modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal

1 file changed

+17
-7
lines changed

modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import dev.deftu.omnicore.internal.client.render.shader.ShaderInternals
77
import org.apache.logging.log4j.LogManager
88
import org.lwjgl.BufferUtils
99
import org.lwjgl.opengl.GL11.*
10+
import org.lwjgl.opengl.GL13
1011
import org.lwjgl.opengl.GL14.*
1112
import org.lwjgl.opengl.GL15.*
1213
import org.lwjgl.opengl.GL20.*
@@ -24,6 +25,7 @@ import org.polyfrost.polyui.unit.Vec4
2425
import org.polyfrost.polyui.utils.toDirectByteBuffer
2526
import org.polyfrost.polyui.utils.toDirectByteBufferNT
2627
import java.nio.ByteBuffer
28+
import java.nio.ByteOrder
2729
import java.nio.FloatBuffer
2830
import kotlin.math.cos
2931
import kotlin.math.roundToInt
@@ -309,7 +311,9 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re
309311

310312
@Suppress("SameParameterValue")
311313
private fun glUniformMatrix3fv(location: Int, transpose: Boolean, array: FloatArray) {
312-
ShaderInternals.uniformMatrix3(location, transpose, array)
314+
val buffer = ByteBuffer.allocateDirect(array.size * 4).order(ByteOrder.nativeOrder()).asFloatBuffer().put(array)
315+
buffer.flip()
316+
ShaderInternals.uniformMatrix3(location, transpose, buffer)
313317
}
314318

315319
override fun init() {
@@ -461,7 +465,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re
461465
popFlushNeeded = false
462466
}
463467

464-
glActiveTexture(GL_TEXTURE0)
468+
@Suppress("RemoveRedundantQualifierName")
469+
GL13.glActiveTexture(GL_TEXTURE0)
465470
glBindTexture(GL_TEXTURE_2D, curTex)
466471

467472
// Quad attrib
@@ -491,7 +496,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re
491496
if (prevDepth) glEnable(GL_DEPTH_TEST)
492497
if (prevCull) glEnable(GL_CULL_FACE)
493498
glUseProgram(prevProg)
494-
glActiveTexture(prevActive)
499+
@Suppress("RemoveRedundantQualifierName")
500+
GL13.glActiveTexture(prevActive)
495501
glBindTexture(GL_TEXTURE_2D, prevTex)
496502
glBindBuffer(GL_ARRAY_BUFFER, prevBuf)
497503
if (GlCapabilities.isGl3Available) org.lwjgl.opengl.GL30.glBindVertexArray(prevVao)
@@ -819,7 +825,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re
819825

820826
val prevActive = glGetInteger(GL_ACTIVE_TEXTURE)
821827
val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D)
822-
glActiveTexture(GL_TEXTURE0)
828+
@Suppress("RemoveRedundantQualifierName")
829+
GL13.glActiveTexture(GL_TEXTURE0)
823830
glBindTexture(GL_TEXTURE_2D, atlas)
824831
glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
825832
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)
@@ -831,7 +838,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re
831838
2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D)
832839
}
833840
glBindTexture(GL_TEXTURE_2D, prevTex)
834-
glActiveTexture(prevActive)
841+
@Suppress("RemoveRedundantQualifierName")
842+
GL13.glActiveTexture(prevActive)
835843

836844
if (image.type == PolyImage.Type.Raster) stb.image_free(d)
837845

@@ -1002,7 +1010,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re
10021010

10031011
val prevActive = glGetInteger(GL_ACTIVE_TEXTURE)
10041012
val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D)
1005-
glActiveTexture(GL_TEXTURE0)
1013+
@Suppress("RemoveRedundantQualifierName")
1014+
GL13.glActiveTexture(GL_TEXTURE0)
10061015
glBindTexture(GL_TEXTURE_2D, atlas)
10071016
glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
10081017
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)
@@ -1025,7 +1034,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re
10251034
2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D)
10261035
}
10271036
glBindTexture(GL_TEXTURE_2D, prevTex)
1028-
glActiveTexture(prevActive)
1037+
@Suppress("RemoveRedundantQualifierName")
1038+
GL13.glActiveTexture(prevActive)
10291039

10301040
slotX += totalSizeX + 1
10311041
atlasRowHeight = maxOf(atlasRowHeight, totalSizeY + 1)

0 commit comments

Comments
 (0)