6 /** Abstracts the GL binding API away */
9 /** Create a GL window class, but does not do anything */
11 /** Fre all resources */
12 virtual ~GLBackend() {}
14 /** Initialize GL backend, choose visual configuration and return the ID */
15 virtual VisualID initialize(Display *display) = 0;
17 /** create a GL context for the given window */
18 virtual void createContext(Window window) = 0;
20 /** Swap back and front buffers */
21 virtual void swapBuffers() const = 0;
23 /** Set the swap interval */
24 virtual void setSwapInterval(int i) const = 0;
27 /** A window to render GL stuff in */
30 GLWindow(Display *display, GLBackend *backend) //!< Create the window class, but do not open it. Taks ownership of the backend and the X connection.
31 : display(display), backend(backend), window(0) {}
34 void open(unsigned int width, unsigned int height) { if (!window) create(width, height); }
36 void setFullscreen(bool fullscreen);
37 bool getFullscreen(void) { return fullscreen; }
39 int getWidth() { return width; }
40 int getHeight() { return height; }
45 const GLBackend * getBackend() { return backend; }
47 virtual void initGL() = 0;
48 virtual void resizeGL(unsigned int width, unsigned int height) = 0;
49 virtual void renderGL() = 0;
50 virtual void handleKeyPress(KeySym key) = 0;
53 void create(unsigned int width, unsigned int height);