]> git.saurik.com Git - wxWidgets.git/blame_incremental - samples/opengl/cube/cube.h
Somehow, setting a tint color makes gauge work :/.
[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// 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
17class TestGLContext : public wxGLContext
18{
19public:
20 TestGLContext(wxGLCanvas *canvas);
21
22 // render the cube showing it at given angles
23 void DrawRotatedCube(float xangle, float yangle);
24
25private:
26 // textures for the cube faces
27 GLuint m_textures[6];
28};
29
30// Define a new application type
31class MyApp : public wxApp
32{
33public:
34 MyApp() { m_glContext = NULL; m_glStereoContext = 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, bool useStereo);
39
40 // virtual wxApp methods
41 virtual bool OnInit();
42 virtual int OnExit();
43
44private:
45 // the GL context we use for all our mono rendering windows
46 TestGLContext *m_glContext;
47 // the GL context we use for all our stereo rendering windows
48 TestGLContext *m_glStereoContext;
49};
50
51// Define a new frame type
52class MyFrame : public wxFrame
53{
54public:
55 MyFrame(bool stereoWindow = false);
56
57private:
58 void OnClose(wxCommandEvent& event);
59 void OnNewWindow(wxCommandEvent& event);
60 void OnNewStereoWindow(wxCommandEvent& event);
61
62 DECLARE_EVENT_TABLE()
63};
64
65class TestGLCanvas : public wxGLCanvas
66{
67public:
68 TestGLCanvas(wxWindow *parent, int *attribList = NULL);
69
70private:
71 void OnPaint(wxPaintEvent& event);
72 void Spin(float xSpin, float ySpin);
73 void OnKeyDown(wxKeyEvent& event);
74 void OnSpinTimer(wxTimerEvent& WXUNUSED(event));
75
76 // angles of rotation around x- and y- axis
77 float m_xangle,
78 m_yangle;
79
80 wxTimer m_spinTimer;
81 bool m_useStereo,
82 m_stereoWarningAlreadyDisplayed;
83
84 DECLARE_EVENT_TABLE()
85};
86
87enum
88{
89 NEW_STEREO_WINDOW = wxID_HIGHEST + 1
90};
91
92#endif // _WX_CUBE_H_