]>
git.saurik.com Git - wxWidgets.git/blob - samples/opengl/cube/cube.h
56e6899fc7056861bf161562abdef3a2d77781ad
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 void OnExit(wxCommandEvent
& event
);
44 void OnNewWindow(wxCommandEvent
& event
);
45 void OnDefRotateLeftKey(wxCommandEvent
& event
);
46 void OnDefRotateRightKey(wxCommandEvent
& event
);
49 TestGLCanvas
*m_canvas
;
54 class TestGLCanvas
: public wxGLCanvas
57 TestGLCanvas(wxWindow
*parent
);
59 void OnPaint(wxPaintEvent
& event
);
60 void OnSize(wxSizeEvent
& event
);
61 void OnKeyDown(wxKeyEvent
& event
);
64 // OpenGL calls can't be done until we're initialized
65 bool IsInitialized() const { return m_gllist
!= 0; }
67 // one-time OpenGL initialization, only does something if !IsInitialized()
74 // the list of commands to draw the cube