]>
git.saurik.com Git - wxWidgets.git/blob - samples/opengl/cube/cube.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGLCanvas demo program
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
14 #include "wx/glcanvas.h"
16 // the rendering context used by all GL canvases
17 class TestGLContext
: public wxGLContext
20 TestGLContext(wxGLCanvas
*canvas
);
22 // render the cube showing it at given angles
23 void DrawRotatedCube(float xangle
, float yangle
);
26 // textures for the cube faces
30 // Define a new application type
31 class MyApp
: public wxApp
34 MyApp() { m_glContext
= NULL
; }
36 // Returns the shared context used by all frames and sets it as current for
38 TestGLContext
& GetContext(wxGLCanvas
*canvas
);
40 // virtual wxApp methods
41 virtual bool OnInit();
45 // the GL context we use for all our windows
46 TestGLContext
*m_glContext
;
49 // Define a new frame type
50 class MyFrame
: public wxFrame
56 void OnClose(wxCommandEvent
& event
);
57 void OnNewWindow(wxCommandEvent
& event
);
62 class TestGLCanvas
: public wxGLCanvas
65 TestGLCanvas(wxWindow
*parent
);
68 void OnPaint(wxPaintEvent
& event
);
69 void Spin(float xSpin
, float ySpin
);
70 void OnKeyDown(wxKeyEvent
& event
);
71 void OnSpinTimer(wxTimerEvent
& WXUNUSED(event
));
73 // angles of rotation around x- and y- axis