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.

OpenGL Error (GL_INVALID_VALUE) at createFontsTexture

See original GitHub issue

Hi, I am getting this error with LibGDX 1.9.9, imgui v1.67-beta-00

Exception in thread "main" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.Exception: OpenGL Error (GL_INVALID_VALUE) at createFontsTexture
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:117)
	at com.x.prototype.desktop.DesktopLauncher.main(DesktopLauncher.kt:17)
Caused by: java.lang.Exception: OpenGL Error (GL_INVALID_VALUE) at createFontsTexture
	at gln.GlnKt.checkError(gln.kt:78)
	at gln.GlnKt.checkError$default(gln.kt:61)
	at imgui.impl.ImplGL3.createFontsTexture(ImplGL3.kt:129)
	at imgui.impl.ImplGL3.createDeviceObjects(ImplGL3.kt:94)
	at imgui.impl.LwjglGlfw.newFrame(LwjglGlfw.kt:107)
	at com.x.prototype.screen.TileEditorScreen.show(TileEditorScreen.kt:23)
	at com.badlogic.gdx.Game.setScreen(Game.java:61)
	at com.x.prototype.App.setCurrentScreen(App.kt:32)
class TileEditorScreen(app: AppContext, val levelName: String, val loadMap: Boolean)
    : BaseScreen(app) {

    private lateinit var context: Context

    override fun show() {
        super.show()
        context = Context()
        LwjglGlfw.init(GlfwWindow.from((Gdx.graphics as Lwjgl3Graphics).window.windowHandle))
        ImGui.styleColorsDark()
    }

    override fun renderScene(delta: Float) {
        LwjglGlfw.newFrame()

        with(ImGui) {
            begin("Demo_0", booleanArrayOf(true), 0)
            text("Hello, world!")
            end()

            showDemoWindow(booleanArrayOf(true))

            render()

            drawData?.run {
                ImplGL3.renderDrawData(this)
            }
        }
    }

    override fun dispose() {
        LwjglGlfw.shutdown()
        context.shutdown()
    }
}

In BaseScreen I have this:

    final override fun render(delta: Float) {
        clearScreen()
        uiStage.act()
        app.soundManager.update()

        renderScene(delta)
        renderHud()
    }

    abstract fun renderScene(delta: Float)

    private fun renderHud() {
        uiStage.draw()
    }

It does not happen when I disable renderHud in render but It happens also when I add after renderScene just empty batch.begin(); batch.end() like this:

abstract class BaseScreen(val app: AppContext) : com.badlogic.gdx.Screen, InputProcessor { //
   ...
   final override fun render(delta: Float) {
        ...
        renderScene(delta)
        batch.begin()
        batch.end()
}

In App I have this:

class App : Game(), AppContext {
    ...
    override var currentScreen: Screen
        get() = screen
        set(value) {
            if (screen != null) {
                screen.dispose()
            }
            setScreen(value)
        }

and I open screen like this:

        loadMap.onClick {
            app.currentScreen = TileEditorScreen(app, mapName.text, true)
        }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Sylvyrfyshcommented, Feb 11, 2019

Can you create a minimal reproducible error? This means create a single file with the least amount needed to create the error. Otherwise, please link the repository.

0reactions
yuraj11commented, Feb 12, 2019

Yes that’s possible. I have solved It by using only one Spritebatch for entire application. Thanks for your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenGL Error: 1281 (Invalid value) #1289 - sp614x/optifine
This is a driver issue and occurs in JVM outside the game . Update your Graphics Diver and see if the latest driver...
Read more >
Font destruction causes OpenGL error when Text is drawn in ...
If a text is drawn to a window in a separate thread, an OpenGL error is reported when the font is destroyed. The...
Read more >
OpenGL error combining renderer text from ttf and background ...
I am having a problem with Opengl and Opengl ES. I want to make squares with png image textures and render text in...
Read more >
Bug #657085 “OpenGL Error 1281 - “Invalid Value
The problem is the following: Currently, JHV only uses textures whose sides have a length which is a power of two. Obviously, in...
Read more >
OpenGL Error: 1281 (Invalid value) Fix? : r/Optifine - Reddit
Every now and then I get this message in the chat box that says "OpenGL Error: 1281 (Invalid value)", are there any causes/fixes...
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