Graphics Window API

  • IGraphicsWindow interface
  • GraphicsWindowWin32 implementation
  • GraphicsWindowX11 implementation
  • GraphicsWindowCarbon implementation (OSX)
  • GraphicsWindowCocoa implementation (OSX, preferred)
 1class IGraphicsWindow {
 3    // X11 only?
 4    chooseVisual();
 6    createContext();
 7    setContext();
 8    getContext();
10    createWindow();
11    getWindow();
12    setWindow();
14    // convience methods
15    std::string getWindowTitle();
16    void setWindowTitle(std::string);
18    // determine how we'll handle "icons." 
19    Icon getWindowIcon();
20    void setWindowIcon(Icon ico);

We could move almost all methods from driver_opengl_window.cpp in this class.

All stuff related to screens, windows, icons, cursors, etc... should be implemented there.

The problem is : where to put GL initialization functions ? such as GLX, WGL, etc... there are most depending on system but will certainly add a dependency on OpenGL.

This class could be non graphical too, ie provide a offscreen renderer and/or not providing a window.

I propose to use IDisplay as interface name, because a display could be a console (with a backbuffer), a window or a screen (if windows doesn't exist).

IDisplay :

  • CWindowsDisplay
  • CCocoaDisplay
  • CCarbonDisplay
  • CXDisplay
  • CWaylandDisplay (the library which will replace X for future versions of Ubuntu)
  • CDirectFBDisplay (for DirectFB)

And even perhaps :

  • CQtDisplay
  • CGtkDisplay
  • etc...

All of them should be shared libs to be able to switch.