49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
#ifndef TARGET_LINUX_DRAW_OPENGL_X11_SERVICE
|
|
#define TARGET_LINUX_DRAW_OPENGL_X11_SERVICE
|
|
#include "allocate/factory.h"
|
|
#include "code/return.h"
|
|
#include <GL/glx.h>
|
|
|
|
class opengl_x11_service_t {
|
|
friend class opengl_x11_service_factory_t;
|
|
public:
|
|
enum error_t {
|
|
none,
|
|
unknown,
|
|
no_visual_found
|
|
};
|
|
struct configuration_t {
|
|
GLXContext glx_context_m;
|
|
};
|
|
return_t<opengl_x11_service_t::error_t, XVisualInfo*> get_visual_info(
|
|
Display* display_p
|
|
);
|
|
void_t<error_t> initialize_context(
|
|
Display* display_p,
|
|
XVisualInfo* visual_info_p,
|
|
Window window_p
|
|
);
|
|
void_t<opengl_x11_service_t::error_t> swap_buffers(
|
|
Display* display_p,
|
|
Window window_p
|
|
);
|
|
void_t<error_t> dispose(
|
|
Display* display_p
|
|
);
|
|
private:
|
|
opengl_x11_service_t(
|
|
configuration_t* configuration_p
|
|
);
|
|
configuration_t* configuration_m;
|
|
};
|
|
class opengl_x11_service_factory_t : public factory_t<opengl_x11_service_t::configuration_t, opengl_x11_service_t, opengl_x11_service_t::error_t> {
|
|
public:
|
|
return_t<opengl_x11_service_t::error_t, opengl_x11_service_t*> create(
|
|
opengl_x11_service_t::configuration_t* configuration_p
|
|
);
|
|
void_t<opengl_x11_service_t::error_t> dispose(
|
|
opengl_x11_service_t* opengl_x11_service_p
|
|
);
|
|
};
|
|
#endif
|