#pragma once #include #include #include #include #include #include namespace endofthejedi { class GLWindow { private: Display* m_display; Window m_rootwnd; GLint m_attributes[23] = { GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, GLX_DOUBLEBUFFER, True, None }; XVisualInfo* m_visualinfo; Colormap m_colormap; XSetWindowAttributes m_swa; Window m_window; GLXContext m_glcontext; XWindowAttributes m_gwa; Atom m_atomWmDeleteWindow; unsigned int m_width; unsigned int m_height; bool m_running = false; protected: virtual void handle(XEvent event); virtual void init(); virtual void render(double time); virtual void resize(); public: GLWindow(unsigned int width, unsigned int height); ~GLWindow(); void loop(); void stop(); void swap(); unsigned int getheight() const { return m_height; } unsigned int getwidth() const { return m_width; } }; }