question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Imgui in minecraft yields nondeterministic rendering issues

See original GitHub issue

This might be related to #112, #99 or #96. My setup is comparable to all three issues.

Setup

  • build.gradle: To work around #112, the fix mentioned in that thread are being used: The rest of the file is omitted for brevity.
compile "com.github.kotlin-graphics:imgui:-SNAPSHOT"
compile 'com.github.kotlin-graphics:uno-sdk:f528113bf45e43406953d6881915467d85a20881'
compile 'com.github.kotlin-graphics.glm:glm:1b4ac18dd1a3c23440d3f33596688aac60bc0141'
compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.3.61'
  • MinecraftScreen.java: The minecraft screen (GUI) (see #99 examples, and the example on the wiki) Source code

Problem

Imgui’s rendering screws up randomly, depending on at what time implGl3 = new ImplGL3(); (in MinecraftScreen) is called.

Sometimes it renders just fine: image

Sometimes it doesn’t render at all.

Sometimes it only draws some glyphs, varying in readability: image More readable: image

Sometimes all text gets cut off slightly. image

How the rendering screws up depends on the current instance of ImplGL3. Each time the player invokes a command causing MinecraftScreen#reload (this method) to be invoked (thus, creating a new instance of ImplGl3), the rendering changes, randomly, to any of the above.

I’m assuming this has something to do with the openGL state imgui sets up for itself. Changing the GL state before any call to implGl3.renderDrawData does not affect how the windows are drawn.

Sorry for opening all of these issues! Thanks for your continued help.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:19

github_iconTop GitHub Comments

2reactions
yaphtcommented, Apr 12, 2021

I’ve managed to avoid both the crashes and rendering issues by initializing ImplGL3 right after the Minecraft window is created in WindowProvider::createWindow.

@Mixin(WindowProvider.class)
public class WindowProviderInit {
    @Inject(at = @At("TAIL"), method = "createWindow")
    public void onCreateWindow(WindowSettings settings, String videoMode, String title, CallbackInfoReturnable<Window> cir) {
        Window window = cir.getReturnValue();    
        // Initialize ImplGL3 here!
    }
}
0reactions
elect86commented, Mar 4, 2020

Nice, let’s keep this open still for a while and if there wont be still any crashe, we’ll consider it resolved

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why modern software is slow | Hacker News
Most games render frames of a 3D world in less than 17ms, but most websites take 3-7 seconds to load because of all...
Read more >
Github Trending - Kotlin is Awesome!
Kotlin/Java library, cli tool and telegram-bot for scraping posts and media from various sources with neither authorization nor full page rendering ...
Read more >
Is it worth to learn C instead of C++ in 2021 / 2022 - Reddit
I'm saying you should learn C as a precursor to C++. As for GUI frameworks, ImGui is worth checking out, but that's C++...
Read more >
SwiftShader - OSCHINA - 中文开源技术交流社区
Cross-platform Real-Time Rendering Library Linux/Mac CPU Windows CPU Status: ... This removes a significant source of network related non-determinism at the ...
Read more >
Jobs *Any* way to access static data safely? - Unity Forum
One approach this problem other than using built-in .NET threading technology to do the work and once done yield back to the main...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found