]> git.saurik.com Git - wxWidgets.git/blame_incremental - samples/opengl/cube/cube.h
wxHtmlHelpController derives from wxHelpControllerBase
[wxWidgets.git] / samples / opengl / cube / cube.h
... / ...
CommitLineData
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
18class TestGLContext : public wxGLContext
19{
20public:
21 TestGLContext(wxGLCanvas *canvas);
22
23 // render the cube showing it at given angles
24 void DrawRotatedCube(float xangle, float yangle);
25
26private:
27 // textures for the cube faces
28 GLuint m_textures[6];
29};
30
31// Define a new application type
32class MyApp : public wxApp
33{
34public:
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
45private:
46 // the GL context we use for all our windows
47 TestGLContext *m_glContext;
48};
49
50// Define a new frame type
51class MyFrame : public wxFrame
52{
53public:
54 MyFrame();
55
56private:
57 void OnClose(wxCommandEvent& event);
58 void OnNewWindow(wxCommandEvent& event);
59
60 DECLARE_EVENT_TABLE()
61};
62
63class TestGLCanvas : public wxGLCanvas
64{
65public:
66 TestGLCanvas(wxWindow *parent);
67
68private:
69 void OnPaint(wxPaintEvent& event);
70 void Spin(float xSpin, float ySpin);
71 void OnKeyDown(wxKeyEvent& event);
72 void OnSpinTimer(wxTimerEvent& WXUNUSED(event));
73
74 // angles of rotation around x- and y- axis
75 float m_xangle,
76 m_yangle;
77
78 wxTimer m_spinTimer;
79
80 DECLARE_EVENT_TABLE()
81};
82
83#endif // _WX_CUBE_H_