{"id":"4yJAarLHu6","url":"https://pastebin.ca/4yJAarLHu6","raw_url":"https://raw.anybin.ca/4yJAarLHu6","visibility":"public","access":"public","created_at":1794189230894,"expires_at":1801965230894,"fetch_limit":null,"fetches_used":0,"reads_remaining":null,"size_bytes":1812,"syntax_hint":null,"title":null,"filename":null,"change_note":null,"cipher":null,"cipher_meta":null,"parent_id":null,"root_id":"4yJAarLHu6","version":1,"owner_id":null,"recipient_id":null,"body":"#include <GL/glx.h>\n#include <SDL3/SDL.h>\n#include <iostream>\n\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\ntypedef void (*GL_CLEARCOLOR_F)(GLfloat, GLfloat, GLfloat, GLfloat);\ntypedef void (*GL_CLEAR_F)(GLbitfield);\ntypedef void (*GL_VIEWPORT_F)(GLint, GLint, GLsizei, GLsizei);\n\nint main()\n{\n    GL_CLEARCOLOR_F glClearColor = (GL_CLEARCOLOR_F)glXGetProcAddress((const GLubyte*)\"glClearColor\");\n    GL_CLEAR_F glClear = (GL_CLEAR_F)glXGetProcAddress((const GLubyte*)\"glCLear\");\n    GL_VIEWPORT_F glViewport = (GL_VIEWPORT_F)glXGetProcAddress((const GLubyte*)\"glViewport\");\n\n    if (!SDL_Init(SDL_INIT_VIDEO))\n        std::cout << \"Can't init SDL: \" << SDL_GetError() << std::endl;\n\n    SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);\n    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);\n    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);\n\n    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);\n\n    SDL_Window* window = SDL_CreateWindow(\"Test\", SCR_WIDTH, SCR_HEIGHT, SDL_WINDOW_OPENGL);\n\n    if (!window)\n        std::cout << \"Can't create window: \" << SDL_GetError() << std::endl;\n\n    SDL_GLContext context = SDL_GL_CreateContext(window);\n\n    if (!context)\n        std::cout << \"Can't create context: \" << SDL_GetError() << std::endl;\n\n    SDL_GL_SetSwapInterval(1);\n    glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);\n\n    bool shouldQuit = false;\n    SDL_Event event;\n\n    while (!shouldQuit)\n    {\n        while (SDL_PollEvent(&event))\n            if (event.type == SDL_EVENT_QUIT)\n                shouldQuit = true;\n\n        glClearColor(1.0f, 0.0f, 0.0f, 1.0f);\n        glClear(GL_COLOR_BUFFER_BIT);\n\n        SDL_GL_SwapWindow(window);\n    }\n\n    SDL_GL_DestroyContext(context);\n    SDL_DestroyWindow(window);\n    SDL_Quit();\n\n    return 0;\n}"}