]>
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
26 class MyFrame
: public wxFrame
29 MyFrame(wxFrame
*frame
, const wxString
& title
, const wxPoint
& pos
,
30 const wxSize
& size
, long style
= wxDEFAULT_FRAME_STYLE
);
32 void OnExit(wxCommandEvent
& event
);
33 void OnNewWindow(wxCommandEvent
& event
);
34 void OnDefRotateLeftKey(wxCommandEvent
& event
);
35 void OnDefRotateRightKey(wxCommandEvent
& event
);
38 TestGLCanvas
* m_canvas
;
45 class TestGLCanvas
: public wxGLCanvas
49 TestGLCanvas(wxWindow
*parent
, const wxWindowID id
= -1,
50 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
51 long style
= 0, const wxString
& name
= _T("TestGLCanvas"));
52 TestGLCanvas(wxWindow
*parent
, const TestGLCanvas
&other
,
53 const wxWindowID id
= -1, const wxPoint
& pos
= wxDefaultPosition
,
54 const wxSize
& size
= wxDefaultSize
, long style
= 0,
55 const wxString
& name
= _T("TestGLCanvas") );
59 void OnPaint(wxPaintEvent
& event
);
60 void OnSize(wxSizeEvent
& event
);
61 void OnEraseBackground(wxEraseEvent
& event
);
62 void OnKeyDown(wxKeyEvent
& event
);
63 void OnKeyUp(wxKeyEvent
& event
);
64 void OnEnterWindow( wxMouseEvent
& event
);
68 void Rotate( GLfloat deg
);
69 static GLfloat
CalcRotateSpeed( unsigned long acceltime
);
70 static GLfloat
CalcRotateAngle( unsigned long lasttime
,
71 unsigned long acceltime
);
72 void Action( long code
, unsigned long lasttime
,
73 unsigned long acceltime
);
81 static unsigned long m_secbase
;
82 static int m_TimeInitialized
;
83 static unsigned long m_xsynct
;
84 static unsigned long m_gsynct
;
87 unsigned long m_StartTime
;
88 unsigned long m_LastTime
;
89 unsigned long m_LastRedraw
;