added multisampling (anti-aliasing) support to wxGLCanvas (#9145)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-06-08 00:12:12 +00:00
parent abbcf16d06
commit c39d2e0a38
10 changed files with 445 additions and 11 deletions

View File

@@ -47,7 +47,9 @@ enum
WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
WX_GL_MIN_ACCUM_ALPHA // use alpha buffer with most bits (> MIN_ACCUM_ALPHA bits)
WX_GL_MIN_ACCUM_ALPHA, // use alpha buffer with most bits (> MIN_ACCUM_ALPHA bits)
WX_GL_SAMPLE_BUFFERS, // 1 for multisampling support (antialiasing)
WX_GL_SAMPLES // 4 for 2x2 antialising supersampling on most graphics cards
};
#define wxGLCanvasName _T("GLCanvas")
@@ -121,6 +123,13 @@ public:
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
@@ -145,6 +154,10 @@ protected:
// (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;

View File

@@ -67,6 +67,9 @@ public:
// Mac-specific functions
// ----------------------
// return true if multisample extension is supported
static bool IsAGLMultiSampleAvailable();
// return the pixel format used by this window
AGLPixelFormat GetAGLPixelFormat() const { return m_aglFormat; }

View File

@@ -141,10 +141,11 @@ protected:
// HDC for this window, we keep it all the time
HDC m_hDC;
void wxGLCanvas::DestroyWindowPFD(wxWindow *parent);
private:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxGLCanvas)
};
#endif // _WX_GLCANVAS_H_

View File

@@ -66,6 +66,9 @@ public:
// return GLX version: 13 means 1.3 &c
static int GetGLXVersion();
// return true if multisample extension is available
static bool IsGLXMultiSampleAvailable();
// get the X11 handle of this window
virtual Window GetXWindow() const = 0;