#pragma once
#include <GL/glx.h>
#include <xcb/xcb.h>
#include <memory>

class GlxInterface
{
public:

    GlxInterface();

    static std::unique_ptr<GlxInterface> Create();

    void SetupContext(Display* display, int default_screen);

    bool SetupWindow(Display* display, xcb_window_t window);

    void DestroyWindow(Display* display);

    void DestroyContext(Display* display);

    void SwapBuffers(Display* display);

    void Draw();

private:
    GLXContext mContext;
    GLXDrawable mDrawable;
    GLXWindow mWindow;
    GLXFBConfig mConfig;
};

using GlxInterfacePtr = std::unique_ptr<GlxInterface>;
