Add code showing stereo support to the OpenGL cube sample.

Show how WX_GL_STEREO attribute can be used, if available.

See #15434.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74819 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-09-15 00:16:44 +00:00
parent e3735e7a9f
commit e848186687
2 changed files with 114 additions and 19 deletions

View File

@@ -31,30 +31,33 @@ private:
class MyApp : public wxApp
{
public:
MyApp() { m_glContext = NULL; }
MyApp() { m_glContext = NULL; m_glStereoContext = NULL; }
// Returns the shared context used by all frames and sets it as current for
// the given canvas.
TestGLContext& GetContext(wxGLCanvas *canvas);
TestGLContext& GetContext(wxGLCanvas *canvas, bool useStereo);
// virtual wxApp methods
virtual bool OnInit();
virtual int OnExit();
private:
// the GL context we use for all our windows
// the GL context we use for all our mono rendering windows
TestGLContext *m_glContext;
// the GL context we use for all our stereo rendering windows
TestGLContext *m_glStereoContext;
};
// Define a new frame type
class MyFrame : public wxFrame
{
public:
MyFrame();
MyFrame(bool stereoWindow = false);
private:
void OnClose(wxCommandEvent& event);
void OnNewWindow(wxCommandEvent& event);
void OnNewStereoWindow(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
@@ -62,7 +65,7 @@ private:
class TestGLCanvas : public wxGLCanvas
{
public:
TestGLCanvas(wxWindow *parent);
TestGLCanvas(wxWindow *parent, int *attribList = NULL);
private:
void OnPaint(wxPaintEvent& event);
@@ -75,8 +78,15 @@ private:
m_yangle;
wxTimer m_spinTimer;
bool m_useStereo,
m_stereoWarningAlreadyDisplayed;
DECLARE_EVENT_TABLE()
};
enum
{
NEW_STEREO_WINDOW = wxID_HIGHEST + 1
};
#endif // _WX_CUBE_H_