#pragma once

#include <GL/glx.h>
#include <memory>

class XcbGlInterface
{
public:
    XcbGlInterface(Display* display, int default_screen);

    ~XcbGlInterface();

    static std::unique_ptr<XcbGlInterface> Create(Display* display, int default_screen);

    Display* getDisplay() const
    {
        return mDisplay;
    }

    GLXContext getContext() const
    {
        return mContext;
    }

    GLXFBConfig getConfig() const
    {
        return mConfig;
    }

private:
    void setupContext(int default_screen);
    void destroyContext();

    Display* mDisplay{nullptr};
    GLXContext mContext;
    GLXFBConfig mConfig;
};

using XcbGlInterfacePtr = std::unique_ptr<XcbGlInterface>;
