]> git.saurik.com Git - wxWidgets.git/blob - samples/opengl/cube/cube.h
define wxUTF8Buf as the type returned by wxString::utf8_str()
[wxWidgets.git] / samples / opengl / cube / cube.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cube.h
3 // Purpose: wxGLCanvas demo program
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_CUBE_H_
13 #define _WX_CUBE_H_
14
15 #include "wx/glcanvas.h"
16
17 // the rendering context used by all GL canvases
18 class TestGLContext : public wxGLContext
19 {
20 public:
21 TestGLContext(wxGLCanvas *canvas);
22
23 // render the cube showing it at given angles
24 void DrawRotatedCube(float xangle, float yangle);
25
26 private:
27 // textures for the cube faces
28 GLuint m_textures[6];
29 };
30
31 // Define a new application type
32 class MyApp: public wxApp
33 {
34 public:
35 MyApp() { m_glContext = NULL; }
36
37 // get the context we use creating it on demand (and set it as current)
38 TestGLContext& GetContext(wxGLCanvas *canvas);
39
40 // virtual wxApp methods
41 virtual bool OnInit();
42 virtual int OnExit();
43
44 private:
45 // the GL context we use for all our windows
46 TestGLContext *m_glContext;
47 };
48
49 // Define a new frame type
50 class MyFrame: public wxFrame
51 {
52 public:
53 MyFrame();
54
55 private:
56 void OnClose(wxCommandEvent& event);
57 void OnNewWindow(wxCommandEvent& event);
58 void OnDefRotateLeftKey(wxCommandEvent& event);
59 void OnDefRotateRightKey(wxCommandEvent& event);
60
61 DECLARE_EVENT_TABLE()
62 };
63
64 class TestGLCanvas : public wxGLCanvas
65 {
66 public:
67 TestGLCanvas(wxWindow *parent);
68
69 private:
70 void OnPaint(wxPaintEvent& event);
71 void OnSize(wxSizeEvent& event);
72 void OnKeyDown(wxKeyEvent& event);
73
74 // angles of rotation around x- and y- axis
75 float m_xangle,
76 m_yangle;
77
78 DECLARE_EVENT_TABLE()
79 };
80
81 #endif // _WX_CUBE_H_
82