Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix crash on window resize #126

Merged
merged 1 commit into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/kotlin/dev/lyzev/api/imgui/render/ImGuiRenderer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ object ImGuiRenderer : EventListener {
private fun preRenderImGui() {
if (ModuleToggleableBlur.isEnabled) {
fbo.clear()
fbo.beginWrite(true)
fbo.beginWrite(false)
}
}

Expand All @@ -92,8 +92,8 @@ object ImGuiRenderer : EventListener {
RenderSystem.defaultBlendFunc()
RenderSystem.enableBlend()

Schizoid.mc.framebuffer.beginWrite(true)
GlStateManager._glBindFramebuffer(GlConst.GL_FRAMEBUFFER, 0)
GlStateManager._viewport(0, 0, Schizoid.mc.framebuffer.viewportWidth, Schizoid.mc.framebuffer.viewportHeight)
ShaderPassThrough.bind()
RenderSystem.activeTexture(GL13.GL_TEXTURE0)
fbo.beginRead()
Expand Down
1 change: 0 additions & 1 deletion src/main/kotlin/dev/lyzev/api/opengl/shader/Shaders.kt
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ object ShaderGameOfLife : ShaderCompute("GameOfLife", 32, 1, 1) {
super.init()
before = WrappedFramebuffer(size, linear = false)
after = WrappedFramebuffer(size, linear = false)
generateRandomPixels()
}

override fun preprocess(source: String) = processIncludes(source).format(myGroupSizeX, myGroupSizeY, myGroupSizeZ, b.toCharArray().joinToString(", "), s.toCharArray().joinToString(", "))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ object ImGuiScreenFeature : ImGuiScreen("Feature Screen"), EventListener {
}
if (it == "Game of Life") {
ShaderGameOfLife.init()
ShaderGameOfLife.generateRandomPixels()
} else {
ShaderGameOfLife.delete()
}
Expand Down Expand Up @@ -94,6 +95,7 @@ object ImGuiScreenFeature : ImGuiScreen("Feature Screen"), EventListener {
) {
ShaderGameOfLife.size = it
ShaderGameOfLife.reload()
ShaderGameOfLife.generateRandomPixels()
}
val gameOfLifeRulestring by text(
"Game of Life Rulestring",
Expand All @@ -107,6 +109,7 @@ object ImGuiScreenFeature : ImGuiScreen("Feature Screen"), EventListener {
ShaderGameOfLife.b = rulestring.substringAfter("B").substringBefore("/")
ShaderGameOfLife.s = rulestring.substringAfter("S")
ShaderGameOfLife.reload()
ShaderGameOfLife.generateRandomPixels()
}

private val texturesMario = Array(3) {
Expand Down Expand Up @@ -140,7 +143,6 @@ object ImGuiScreenFeature : ImGuiScreen("Feature Screen"), EventListener {
val search = ImGuiRenderableSearch()
val devTools = ImGuiRenderableDeveloperTool()
val configManager = ImGuiRenderableConfigManager()
private val fbo = WrappedFramebuffer()

override fun onDisplayed() {
ShaderGameOfLife.generateRandomPixels()
Expand Down
Loading