Reinitialize console after closing OpenGL

Post Reply
Posts: 16
Joined: Tue Jun 01, 2010 11:02 am
Location: Germany

Reinitialize console after closing OpenGL

Post by Tenry » Fri Jul 05, 2024 1:01 pm

Hi! I am writing a game using OpenGL + EGL. I follow the structure of "examples/switch/graphics/opengl/simple_triangle" for initializing and quitting OpenGL and EGL.

What do I need to do to bring back the console on the screen (and quitting OpenGL)?

My use case: If some error (exception) occurs, I want to shut down OpenGL and EGL and initialize the console again (consoleInit) and show the error message on the screen. I'm testing using the Suyu emulator on Linux.

I tried various variations of deinitializing EGL and initializing the console, and this is my code so far:

Code: Select all

// "error" occurred
// doing consoleInit(NULL) has no effect here
// doing consoleInit(NULL) has no effect here
eglDestroyContext(eglDisplay, eglContext);
// doing consoleInit(NULL) has no effect here

// the following line causes the Suyu emulator to crash in Vulkan mode with "VK_ERROR_INITIALIZATION_FAILED" error
// using OpenGL, it shows "QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined" warning, but keeps running
eglDestroySurface(eglDisplay, eglSurface);
// doing consoleInit(NULL) has some kind of effect, but it appears so switch between normal white and small green text every frame

// this does not seem to work as expected
// eglTerminate(eglDisplay);

printf("the error message\n");
while (appletMainLoop()) {
Please note that I do consoleInit(NULL) initially for any startup messages and consoleExit(NULL) right before initializing EGL. But also without initializing and quitting console before EGL, this does not seem to make any difference.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests