]>
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
24 // Define a new frame type
27 class MyFrame
: public wxFrame
30 static MyFrame
*Create(MyFrame
*parentFrame
, bool isCloneWindow
= false);
32 void OnExit(wxCommandEvent
& event
);
33 void OnNewWindow(wxCommandEvent
& event
);
34 void OnDefRotateLeftKey(wxCommandEvent
& event
);
35 void OnDefRotateRightKey(wxCommandEvent
& event
);
39 MyFrame(wxWindow
*parent
, const wxString
& title
, const wxPoint
& pos
,
40 const wxSize
& size
, long style
= wxDEFAULT_FRAME_STYLE
);
43 TestGLCanvas
*m_canvas
;
50 class TestGLCanvas
: public wxGLCanvas
54 TestGLCanvas( wxWindow
*parent
, wxWindowID id
= wxID_ANY
,
55 const wxPoint
& pos
= wxDefaultPosition
,
56 const wxSize
& size
= wxDefaultSize
,
57 long style
= 0, const wxString
& name
= _T("TestGLCanvas") );
59 TestGLCanvas( wxWindow
*parent
, const TestGLCanvas
&other
,
60 wxWindowID id
= wxID_ANY
, const wxPoint
& pos
= wxDefaultPosition
,
61 const wxSize
& size
= wxDefaultSize
, long style
= 0,
62 const wxString
& name
= _T("TestGLCanvas") );
66 void OnPaint(wxPaintEvent
& event
);
67 void OnSize(wxSizeEvent
& event
);
68 void OnEraseBackground(wxEraseEvent
& event
);
69 void OnKeyDown(wxKeyEvent
& event
);
70 void OnKeyUp(wxKeyEvent
& event
);
71 void OnEnterWindow(wxMouseEvent
& event
);
75 void Rotate(GLfloat deg
);
76 static GLfloat
CalcRotateSpeed(unsigned long acceltime
);
77 static GLfloat
CalcRotateAngle( unsigned long lasttime
,
78 unsigned long acceltime
);
79 void Action( long code
, unsigned long lasttime
,
80 unsigned long acceltime
);
88 static unsigned long m_secbase
;
89 static int m_TimeInitialized
;
90 static unsigned long m_xsynct
;
91 static unsigned long m_gsynct
;
94 unsigned long m_StartTime
;
95 unsigned long m_LastTime
;
96 unsigned long m_LastRedraw
;
101 #endif // #if wxUSE_GLCANVAS
103 #endif // #ifndef _WX_CUBE_H_