]> git.saurik.com Git - wxWidgets.git/blob - samples/opengl/cube/cube.h
Don't send wxEVT_COMMAND_TREE_ITEM_MENU event without valid item in wxMSW.
[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 // Returns the shared context used by all frames and sets it as current for
38 // the given canvas.
39 TestGLContext& GetContext(wxGLCanvas *canvas);
40
41 // virtual wxApp methods
42 virtual bool OnInit();
43 virtual int OnExit();
44
45 private:
46 // the GL context we use for all our windows
47 TestGLContext *m_glContext;
48 };
49
50 // Define a new frame type
51 class MyFrame : public wxFrame
52 {
53 public:
54 MyFrame();
55
56 private:
57 void OnClose(wxCommandEvent& event);
58 void OnNewWindow(wxCommandEvent& event);
59
60 DECLARE_EVENT_TABLE()
61 };
62
63 class TestGLCanvas : public wxGLCanvas
64 {
65 public:
66 TestGLCanvas(wxWindow *parent);
67
68 private:
69 void OnPaint(wxPaintEvent& event);
70 void OnKeyDown(wxKeyEvent& event);
71
72 // angles of rotation around x- and y- axis
73 float m_xangle,
74 m_yangle;
75
76 DECLARE_EVENT_TABLE()
77 };
78
79 #endif // _WX_CUBE_H_