]>
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 // one-time OpenGL initialization, safe to call many times
31 // the list of commands to draw the cube
35 // Define a new application type
36 class MyApp
: public wxApp
39 MyApp() { m_glContext
= NULL
; }
41 // get the context we use creating it on demand (and set it as current)
42 TestGLContext
& GetContext(wxGLCanvas
*canvas
);
44 // virtual wxApp methods
45 virtual bool OnInit();
49 // the GL context we use for all our windows
50 TestGLContext
*m_glContext
;
53 // Define a new frame type
54 class MyFrame
: public wxFrame
60 void OnClose(wxCommandEvent
& event
);
61 void OnNewWindow(wxCommandEvent
& event
);
62 void OnDefRotateLeftKey(wxCommandEvent
& event
);
63 void OnDefRotateRightKey(wxCommandEvent
& event
);
68 class TestGLCanvas
: public wxGLCanvas
71 TestGLCanvas(wxWindow
*parent
);
74 void OnPaint(wxPaintEvent
& event
);
75 void OnSize(wxSizeEvent
& event
);
76 void OnKeyDown(wxKeyEvent
& event
);
78 // angles of rotation around x- and y- axis