]>
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 // get the context we use creating it on demand (and set it as current)
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
);
58 void OnDefRotateLeftKey(wxCommandEvent
& event
);
59 void OnDefRotateRightKey(wxCommandEvent
& event
);
64 class TestGLCanvas
: public wxGLCanvas
67 TestGLCanvas(wxWindow
*parent
);
70 void OnPaint(wxPaintEvent
& event
);
71 void OnSize(wxSizeEvent
& event
);
72 void OnKeyDown(wxKeyEvent
& event
);
74 // angles of rotation around x- and y- axis