Skip to content

Commit

Permalink
Add GL state changes, might fix rendering conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry282 committed Aug 13, 2024
1 parent 44a1958 commit 6c3559b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/main/kotlin/funnymap/features/dungeon/MapRenderList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import funnymap.utils.MapUtils
import funnymap.utils.MapUtils.connectorSize
import funnymap.utils.MapUtils.halfRoomSize
import funnymap.utils.MapUtils.roomSize
import funnymap.utils.RenderUtils
import funnymap.utils.RenderUtils.darken
import funnymap.utils.RenderUtils.grayScale
import funnymap.utils.RenderUtilsGL
Expand Down Expand Up @@ -61,6 +62,10 @@ object MapRenderList {
updateRenderMap()
}

GlStateManager.pushMatrix()
RenderUtils.preDraw()
RenderUtilsGL.preDraw()

mc.mcProfiler.startSection("border")

if (borderGlList != -1) GL11.glCallList(borderGlList)
Expand All @@ -81,6 +86,9 @@ object MapRenderList {
if (roomGlList != -1) GL11.glCallList(roomGlList)

RenderUtilsGL.unbindTexture()
RenderUtils.postDraw()
RenderUtilsGL.postDraw()
GlStateManager.popMatrix()

if (!inBoss) {
mc.mcProfiler.endStartSection("heads")
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/funnymap/utils/RenderUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object RenderUtils {
val legacyCheckmarks = CheckmarkSet(8, "legacy")
private val mapIcons = ResourceLocation("funnymap", "marker.png")

private fun preDraw() {
fun preDraw() {
GlStateManager.enableAlpha()
GlStateManager.enableBlend()
GlStateManager.disableDepth()
Expand All @@ -41,7 +41,7 @@ object RenderUtils {
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0)
}

private fun postDraw() {
fun postDraw() {
GlStateManager.disableBlend()
GlStateManager.enableDepth()
GlStateManager.enableTexture2D()
Expand Down

0 comments on commit 6c3559b

Please sign in to comment.