]>
git.saurik.com Git - wxWidgets.git/blob - samples/opengl/cube/cube.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGLCanvas demo program
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/glcanvas.h"
17 // Define a new application type
18 class MyApp
: public wxApp
21 MyApp() { m_glContext
= NULL
; }
23 // set the specified canvas for current output
24 void SetCurrent(wxGLCanvas
*canvas
);
26 // virtual wxApp methods
27 virtual bool OnInit();
31 // the GL context we use for all our windows
32 wxGLContext
*m_glContext
;
35 // Define a new frame type
38 class MyFrame
: public wxFrame
43 // update the image shown on the canvas (after the shared wxGLContext was
44 // updated, presumably)
48 void OnClose(wxCommandEvent
& event
);
49 void OnNewWindow(wxCommandEvent
& event
);
50 void OnDefRotateLeftKey(wxCommandEvent
& event
);
51 void OnDefRotateRightKey(wxCommandEvent
& event
);
53 TestGLCanvas
*m_canvas
;
58 class TestGLCanvas
: public wxGLCanvas
61 TestGLCanvas(wxWindow
*parent
);
64 void OnPaint(wxPaintEvent
& event
);
65 void OnSize(wxSizeEvent
& event
);
66 void OnKeyDown(wxKeyEvent
& event
);
68 // OpenGL calls can't be done until we're initialized
69 bool IsInitialized() const { return m_gllist
!= 0; }
71 // one-time OpenGL initialization, only does something if !IsInitialized()
78 // the list of commands to draw the cube