]>
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 // the rendering context used by all GL canvases
18 class TestGLContext
: public wxGLContext
21 TestGLContext(wxGLCanvas
*canvas
);
23 // render the cube showing it at given angles
24 void DrawRotatedCube(float xangle
, float yangle
);
27 // textures for the cube faces
31 // Define a new application type
32 class MyApp
: public wxApp
35 MyApp() { m_glContext
= NULL
; }
37 // Returns the shared context used by all frames and sets it as current for
39 TestGLContext
& GetContext(wxGLCanvas
*canvas
);
41 // virtual wxApp methods
42 virtual bool OnInit();
46 // the GL context we use for all our windows
47 TestGLContext
*m_glContext
;
50 // Define a new frame type
51 class MyFrame
: public wxFrame
57 void OnClose(wxCommandEvent
& event
);
58 void OnNewWindow(wxCommandEvent
& event
);
63 class TestGLCanvas
: public wxGLCanvas
66 TestGLCanvas(wxWindow
*parent
);
69 void OnPaint(wxPaintEvent
& event
);
70 void Spin(float xSpin
, float ySpin
);
71 void OnKeyDown(wxKeyEvent
& event
);
72 void OnSpinTimer(wxTimerEvent
& WXUNUSED(event
));
74 // angles of rotation around x- and y- axis