]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: penguin.h | |
3 | // Purpose: wxGLCanvas demo program | |
4 | // Author: Robert Roebling | |
5 | // Modified by: | |
6 | // Created: 04/01/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Robert Roebling | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_PENGUIN_H_ | |
13 | #define _WX_PENGUIN_H_ | |
14 | ||
15 | ||
16 | #include "wx/defs.h" | |
17 | #include "wx/app.h" | |
18 | #include "wx/menu.h" | |
19 | #include "wx/dcclient.h" | |
20 | #include "wx/wfstream.h" | |
21 | #if wxUSE_ZLIB | |
22 | #include "wx/zstream.h" | |
23 | #endif | |
24 | ||
25 | #include "wx/glcanvas.h" | |
26 | ||
27 | extern "C" | |
28 | { | |
29 | #include "trackball.h" | |
30 | } | |
31 | ||
32 | #include "dxfrenderer.h" | |
33 | ||
34 | // OpenGL view data | |
35 | struct GLData | |
36 | { | |
37 | bool initialized; // have OpenGL been initialized? | |
38 | float beginx, beginy; // position of mouse | |
39 | float quat[4]; // orientation of object | |
40 | float zoom; // field of view in degrees | |
41 | }; | |
42 | ||
43 | // Define a new application type | |
44 | class MyApp: public wxApp | |
45 | { | |
46 | public: | |
47 | bool OnInit(); | |
48 | }; | |
49 | ||
50 | // Define a new frame type | |
51 | class TestGLCanvas; | |
52 | ||
53 | class MyFrame: public wxFrame | |
54 | { | |
55 | public: | |
56 | MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, | |
57 | const wxSize& size, long style = wxDEFAULT_FRAME_STYLE); | |
58 | ||
59 | void OnMenuFileOpen(wxCommandEvent& event); | |
60 | void OnMenuFileExit(wxCommandEvent& event); | |
61 | void OnMenuHelpAbout(wxCommandEvent& event); | |
62 | ||
63 | #if wxUSE_GLCANVAS | |
64 | void SetCanvas( TestGLCanvas *canvas ) { m_canvas = canvas; } | |
65 | TestGLCanvas *GetCanvas() { return m_canvas; } | |
66 | ||
67 | private: | |
68 | TestGLCanvas *m_canvas; | |
69 | #endif | |
70 | ||
71 | DECLARE_EVENT_TABLE() | |
72 | }; | |
73 | ||
74 | #if wxUSE_GLCANVAS | |
75 | ||
76 | class TestGLCanvas: public wxGLCanvas | |
77 | { | |
78 | public: | |
79 | TestGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, | |
80 | const wxPoint& pos = wxDefaultPosition, | |
81 | const wxSize& size = wxDefaultSize, long style = 0, | |
82 | const wxString& name = wxT("TestGLCanvas")); | |
83 | ||
84 | ~TestGLCanvas(); | |
85 | ||
86 | void LoadDXF(const wxString& filename); | |
87 | ||
88 | protected: | |
89 | void OnPaint(wxPaintEvent& event); | |
90 | void OnSize(wxSizeEvent& event); | |
91 | void OnEraseBackground(wxEraseEvent& event); | |
92 | void OnMouse(wxMouseEvent& event); | |
93 | ||
94 | private: | |
95 | void InitGL(); | |
96 | void ResetProjectionMode(); | |
97 | ||
98 | GLData m_gldata; | |
99 | DXFRenderer m_renderer; | |
100 | ||
101 | DECLARE_EVENT_TABLE() | |
102 | }; | |
103 | ||
104 | #endif // #if wxUSE_GLCANVAS | |
105 | ||
106 | #endif // #ifndef _WX_PENGUIN_H_ | |
107 |