#include "wx/palette.h"
#include "wx/window.h"
-class WXDLLIMPEXP_GL wxGLCanvas;
-class WXDLLIMPEXP_GL wxGLContext;
+class WXDLLIMPEXP_FWD_GL wxGLCanvas;
+class WXDLLIMPEXP_FWD_GL wxGLContext;
// ----------------------------------------------------------------------------
// Constants for attributes list
*/
// set this context as the current one
- virtual void SetCurrent(const wxGLCanvas& win) const = 0;
+ virtual bool SetCurrent(const wxGLCanvas& win) const = 0;
};
// ----------------------------------------------------------------------------
{
public:
// default ctor doesn't initialize the window, use Create() later
- wxGLCanvasBase()
- {
-#if WXWIN_COMPATIBILITY_2_8
- m_glContext = NULL;
-#endif
- }
+ wxGLCanvasBase();
virtual ~wxGLCanvasBase();
// ----------
// set the given context associated with this window as the current one
- void SetCurrent(const wxGLContext& context) const;
+ bool SetCurrent(const wxGLContext& context) const;
// flush the back buffer (if we have it)
- virtual void SwapBuffers() = 0;
+ virtual bool SwapBuffers() = 0;
// accessors
// call glcolor() for the colour with the given name, return false if
// colour not found
- bool SetColour(const wxChar *colour);
+ bool SetColour(const wxString& colour);
#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;
+};
+
#if defined(__WXMSW__)
#include "wx/msw/glcanvas.h"
#elif defined(__WXMOTIF__) || defined(__WXX11__)
#error "wxGLCanvas not supported in this wxWidgets port"
#endif
-class WXDLLIMPEXP_GL wxGLApp : public wxApp
+// wxMac and wxMSW don't need anything extra in wxGLAppBase, so declare it here
+#ifndef wxGL_APP_DEFINED
+
+class WXDLLIMPEXP_GL wxGLApp : public wxGLAppBase
{
public:
- wxGLApp() : wxApp() { }
+ wxGLApp() : wxGLAppBase() { }
- // 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.
- bool InitGLVisual(const int *attribList);
+ virtual bool InitGLVisual(const int *attribList);
private:
DECLARE_DYNAMIC_CLASS(wxGLApp)
};
+#endif // !wxGL_APP_DEFINED
+
#endif // wxUSE_GLCANVAS
#endif // _WX_GLCANVAS_H_BASE_