X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fglws.hpp;h=a8b6844d117cdef527909dd47c889cf3361574a4;hb=d6b7eb6b7c8280762fb635a6e63aa3a426694ed7;hp=9afebf4b878a4b639863bb08d8bf12927fbd0495;hpb=9d27a54b0381610c30964880a5fdd4c27bb6e732;p=apitrace diff --git a/retrace/glws.hpp b/retrace/glws.hpp index 9afebf4..a8b6844 100644 --- a/retrace/glws.hpp +++ b/retrace/glws.hpp @@ -31,7 +31,11 @@ #define _GLWS_HPP_ +#include + #include +#include +#include namespace glws { @@ -46,9 +50,6 @@ enum Profile { }; -extern bool debug; - - bool checkExtension(const char *extName, const char *extString); @@ -101,12 +102,14 @@ public: const Visual *visual; int width; int height; + bool pbuffer; bool visible; - Drawable(const Visual *vis, int w, int h) : + Drawable(const Visual *vis, int w, int h, bool pb) : visual(vis), width(w), height(h), + pbuffer(pb), visible(false) {} @@ -120,9 +123,12 @@ public: virtual void show(void) { + assert(!pbuffer); visible = true; } + virtual void copySubBuffer(int x, int y, int width, int height) = 0; + virtual void swapBuffers(void) = 0; }; @@ -133,12 +139,18 @@ public: const Visual *visual; Profile profile; + std::set extensions; + Context(const Visual *vis, Profile prof) : visual(vis), profile(prof) {} virtual ~Context() {} + + // Context must be current + bool + hasExtension(const char *extension); }; @@ -152,10 +164,10 @@ Visual * createVisual(bool doubleBuffer = false, Profile profile = PROFILE_COMPAT); Drawable * -createDrawable(const Visual *visual, int width = 32, int height = 32); +createDrawable(const Visual *visual, int width, int height, bool pbuffer = false); Context * -createContext(const Visual *visual, Context *shareContext = 0, Profile profile = PROFILE_COMPAT); +createContext(const Visual *visual, Context *shareContext = 0, Profile profile = PROFILE_COMPAT, bool debug = false); bool makeCurrent(Drawable *drawable, Context *context);