+// ----------------------------------------------------------------------------
+// wxGLContextBase: OpenGL rendering context
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_GL wxGLContextBase : public wxObject
+{
+public:
+ /*
+ The derived class should provide a ctor with this signature:
+
+ wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL);
+ */
+
+ // set this context as the current one
+ virtual bool SetCurrent(const wxGLCanvas& win) const = 0;
+};
+
+// ----------------------------------------------------------------------------
+// wxGLCanvasBase: window which can be used for OpenGL rendering
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_GL wxGLCanvasBase : public wxWindow
+{
+public:
+ // default ctor doesn't initialize the window, use Create() later
+ wxGLCanvasBase();
+
+ virtual ~wxGLCanvasBase();
+
+
+ /*
+ The derived class should provide a ctor with this signature:
+
+ wxGLCanvas(wxWindow *parent,
+ wxWindowID id = wxID_ANY,
+ int* attribList = 0,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxGLCanvasName,
+ const wxPalette& palette = wxNullPalette);
+ */
+
+ // operations
+ // ----------
+
+ // set the given context associated with this window as the current one
+ bool SetCurrent(const wxGLContext& context) const;
+
+ // flush the back buffer (if we have it)
+ virtual bool SwapBuffers() = 0;
+
+
+ // accessors
+ // ---------
+
+ // check if the given attributes are supported without creating a canvas
+ static bool IsDisplaySupported(const int *attribList);
+
+ const wxPalette *GetPalette() const { return &m_palette; }
+
+ // miscellaneous helper functions
+ // ------------------------------
+
+ // call glcolor() for the colour with the given name, return false if
+ // colour not found
+ bool SetColour(const wxString& colour);
+
+
+ // return true if the extension with given name is supported
+ //
+ // notice that while this function is implemented for all of GLX, WGL and
+ // AGL the extensions names are usually not the same for different
+ // platforms and so the code using it still usually uses conditional
+ // compilation
+ static bool IsExtensionSupported(const char *extension);
+
+ // deprecated methods using the implicit wxGLContext
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( wxGLContext* GetContext() const );
+
+ wxDEPRECATED( void SetCurrent() );
+
+ wxDEPRECATED( void OnSize(wxSizeEvent& event) );
+#endif // WXWIN_COMPATIBILITY_2_8
+
+#ifdef __WXUNIVERSAL__
+ // resolve the conflict with wxWindowUniv::SetCurrent()
+ virtual bool SetCurrent(bool doit) { return wxWindow::SetCurrent(doit); };
+#endif
+
+protected:
+ // override this to implement SetColour() in GL_INDEX_MODE
+ // (currently only implemented in wxX11 and wxMotif ports)
+ virtual int GetColourIndex(const wxColour& WXUNUSED(col)) { return -1; }
+
+ // create default palette if we're not using RGBA mode
+ // (not supported in most ports)
+ virtual wxPalette CreateDefaultPalette() { return wxNullPalette; }
+
+ // check if the given extension name is present in the space-separated list
+ // of extensions supported by the current implementation such as returned
+ // by glXQueryExtensionsString() or glGetString(GL_EXTENSIONS)
+ static bool IsExtensionInList(const char *list, const char *extension);
+
+ wxPalette m_palette;
+
+#if WXWIN_COMPATIBILITY_2_8
+ wxGLContext *m_glContext;
+#endif // WXWIN_COMPATIBILITY_2_8
+};
+
+// ----------------------------------------------------------------------------
+// wxGLApp: a special wxApp subclass for OpenGL applications which must be used
+// to select a visual compatible with the given attributes
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_GL wxGLAppBase : public wxApp
+{
+public:
+ wxGLAppBase() : wxApp() { }
+
+ // use this in the constructor of the user-derived wxGLApp class to
+ // determine if an OpenGL rendering context with these attributes
+ // is available - returns true if so, false if not.
+ virtual bool InitGLVisual(const int *attribList) = 0;
+};
+