]> git.saurik.com Git - wxWidgets.git/blob - samples/opengl/cube/cube.h
Turkish translations update from Çağrı Doğan.
[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 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_CUBE_H_
12 #define _WX_CUBE_H_
13
14 #include "wx/glcanvas.h"
15
16 // the rendering context used by all GL canvases
17 class TestGLContext : public wxGLContext
18 {
19 public:
20 TestGLContext(wxGLCanvas *canvas);
21
22 // render the cube showing it at given angles
23 void DrawRotatedCube(float xangle, float yangle);
24
25 private:
26 // textures for the cube faces
27 GLuint m_textures[6];
28 };
29
30 // Define a new application type
31 class MyApp : public wxApp
32 {
33 public:
34 MyApp() { m_glContext = NULL; }
35
36 // Returns the shared context used by all frames and sets it as current for
37 // the given canvas.
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
59 DECLARE_EVENT_TABLE()
60 };
61
62 class TestGLCanvas : public wxGLCanvas
63 {
64 public:
65 TestGLCanvas(wxWindow *parent);
66
67 private:
68 void OnPaint(wxPaintEvent& event);
69 void Spin(float xSpin, float ySpin);
70 void OnKeyDown(wxKeyEvent& event);
71 void OnSpinTimer(wxTimerEvent& WXUNUSED(event));
72
73 // angles of rotation around x- and y- axis
74 float m_xangle,
75 m_yangle;
76
77 wxTimer m_spinTimer;
78
79 DECLARE_EVENT_TABLE()
80 };
81
82 #endif // _WX_CUBE_H_