r/sdl

▲ 2 r/sdl+1 crossposts

Stencil buffer size is always 0 bits

Hey ! I'm currently building an game engine with SDL3 + OpenGL of my own, and now that I'm implementing effects using the stencil buffer, now matter what I do, I cannot seem to initialise it correctly, here is my method tasked of initialising my window. Did I miss something ?

SDL_AppResult Window::SDL_AppInit()
{
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);


    // Profil OpenGL
    SDL_GL_SetAttribute(
        SDL_GL_CONTEXT_PROFILE_MASK,
        SDL_GL_CONTEXT_PROFILE_CORE
    );


    SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
    SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);


    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
    SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); // 8 bits stencil buffer


    wind = SDL_CreateWindow("SMT", SDL_WINDOW_WIDTH, SDL_WINDOW_HEIGHT, SDL_WINDOW_OPENGL);
    if (wind == NULL)
    {
        cout << "Window creation failed !";
        return SDL_APP_FAILURE;
    }
    this->context = SDL_GL_CreateContext(wind);
    SDL_GL_MakeCurrent(wind, this->context);


    if (!gladLoadGLLoader( (GLADloadproc)SDL_GL_GetProcAddress ) )
    {
        cout << "glad init failed" << endl;
        return SDL_APP_FAILURE;
    }
    
    glViewport(0,0,SDL_WINDOW_WIDTH,SDL_WINDOW_HEIGHT);
    return SDL_APP_CONTINUE;
}
reddit.com
u/Economy-Dig3969 — 15 hours ago
▲ 0 r/sdl

I just downloaded stl3 from github but I'm not getting the stl.h that I need from it

so, when I'm using vs code, I have to include libraries as we all know and when I search up stl.h it shows up in the file search on git hub however in the files I get when downloading I it doesn't appear and I find it irritating. Anyone has these problems as well or know how to fix it I downloaded the latest one

reddit.com
u/Charming_Freedom6609 — 7 days ago
▲ 5 r/sdl

Update of GUI-toolkit integrated with SDL's events

https://i.redd.it/nqjq98kffaah1.gif

https://i.redd.it/8x2yo48hfaah1.gif

The GUI-toolkit is now about 1000 lines of C code. Both demo programs is about 250 lines of C code each. The more exotic type of widgets that i have is range and shuttle. And you can turn on or of the GUI with one codeline for hiding och showing the GUI. And all graphics is off-cause identical on any platform if you use the same font.

I made this experiment to test if I could make a GUI-toolkit in C code and programs written in C, that uses less code then than the usual toolkits and programs written in C++.

If I release it as open source, I need to write a lot of documentation and a lot of demo programs i guess. And go though the name space and check that everything has good names, as those things tend to stick.

reddit.com
u/Future-Mixture-101 — 7 days ago
▲ 9 r/sdl

SDL3 Open Gl

Any resources for this and any libs I should be using in conjunction? Thanks

Or should I just bite the bullet and use sdlgpu

reddit.com
u/Available_Impact_828 — 14 days ago