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

Failure to enable OpenGL Debug Messages #261

Open
jensenr30 opened this issue Jan 30, 2025 · 0 comments
Open

Failure to enable OpenGL Debug Messages #261

jensenr30 opened this issue Jan 30, 2025 · 0 comments

Comments

@jensenr30
Copy link

When I changed from sdl2 to sdl2-compat on arch linux, it broke part of my application.

Previously, I was able to enable the Debug flag for OpenGL, but now it doesn't work.

This code used to work with SDL2, but now it fails:

    if (SDL_Init(SDL_INIT_VIDEO) != 0) {
        log_error("SDL_Init ERROR");
        return -1;
    }
        window = SDL_CreateWindow("OpenGL Window", 0,0, get_screen().w, get_screen().h, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
    if (!window) {
        log_error("Failed to make window\n");
        return -1;
    }
// ...
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 6);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
// ...
        gl_context = SDL_GL_CreateContext(window);
// ...
    if (!gladLoadGLLoader(SDL_GL_GetProcAddress)) {
        printf("GLAD load failed!\n");
        return -1;
    }

// ...
    static int flags; glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
    if (flags & GL_CONTEXT_FLAG_DEBUG_BIT) {
        glEnable(GL_DEBUG_OUTPUT);
        glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
        glDebugMessageCallback(opengl_debug_callback, nullptr);
        glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE);
        glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 0,
                             GL_DEBUG_SEVERITY_NOTIFICATION, -1,
                             "OpenGL Debug messages are up and running.");
    } else {
        log_error("Failed to enable OpenGL debug messages!\n");
        return;
    }

My application now prints "Failed to enable OpenGL debug messages!\n" and it didn't do that before I switched to sdl2-compat.

System Information:

OS: Arch Linux x86_64
Kernel: Linux 6.12.10-arch1-1
Uptime: 49 mins
Packages: 1698 (pacman), 2 (flatpak)
Shell: bash 5.2.37
Display (DisplayPort-1): 2560x1440 @ 165 Hz in 27" [External] *
Display (DisplayPort-0): 2560x1440 @ 60 Hz in 27" [External]
WM: i3 (X11)
...
CPU: 13th Gen Intel(R) Core(TM) i5-13600K (20) @ 5.10 GHz
GPU: AMD Radeon RX 6750 XT [Discrete]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant