]>
Commit | Line | Data |
---|---|---|
8b089c5e JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: penguin.h | |
3 | // Purpose: wxGLCanvas demo program | |
4 | // Author: Robert Roebling | |
5 | // Modified by: | |
6 | // Created: 04/01/98 | |
8b089c5e | 7 | // Copyright: (c) Robert Roebling |
2f6c54eb | 8 | // Licence: wxWindows licence |
8b089c5e JS |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_PENGUIN_H_ | |
12 | #define _WX_PENGUIN_H_ | |
13 | ||
14 | ||
15 | #include "wx/defs.h" | |
16 | #include "wx/app.h" | |
17 | #include "wx/menu.h" | |
18 | #include "wx/dcclient.h" | |
4b764db3 JS |
19 | #include "wx/wfstream.h" |
20 | #if wxUSE_ZLIB | |
21 | #include "wx/zstream.h" | |
22 | #endif | |
8b089c5e JS |
23 | |
24 | #include "wx/glcanvas.h" | |
25 | ||
5cf036d0 DS |
26 | extern "C" |
27 | { | |
8b089c5e JS |
28 | #include "trackball.h" |
29 | } | |
30 | ||
4b764db3 | 31 | #include "dxfrenderer.h" |
8b089c5e | 32 | |
451c13c8 | 33 | |
4b764db3 JS |
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 | }; | |
8b089c5e | 42 | |
451c13c8 | 43 | |
4b764db3 | 44 | // Define a new application type |
451c13c8 | 45 | class MyApp : public wxApp |
8b089c5e JS |
46 | { |
47 | public: | |
451c13c8 | 48 | virtual bool OnInit(); |
8b089c5e JS |
49 | }; |
50 | ||
451c13c8 | 51 | |
4b764db3 | 52 | // Define a new frame type |
8b089c5e | 53 | class TestGLCanvas; |
bcc4c541 | 54 | |
451c13c8 VZ |
55 | |
56 | class MyFrame : public wxFrame | |
8b089c5e JS |
57 | { |
58 | public: | |
5cf036d0 | 59 | MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, |
451c13c8 | 60 | const wxSize& size, long style = wxDEFAULT_FRAME_STYLE); |
8b089c5e | 61 | |
4b764db3 JS |
62 | void OnMenuFileOpen(wxCommandEvent& event); |
63 | void OnMenuFileExit(wxCommandEvent& event); | |
64 | void OnMenuHelpAbout(wxCommandEvent& event); | |
5cf036d0 | 65 | |
451c13c8 | 66 | void SetCanvas(TestGLCanvas *canvas) { m_canvas = canvas; } |
5cf036d0 DS |
67 | TestGLCanvas *GetCanvas() { return m_canvas; } |
68 | ||
bcc4c541 | 69 | private: |
5cf036d0 | 70 | TestGLCanvas *m_canvas; |
8b089c5e | 71 | |
bcc4c541 | 72 | DECLARE_EVENT_TABLE() |
8b089c5e JS |
73 | }; |
74 | ||
2db98bf5 | 75 | |
451c13c8 | 76 | class TestGLCanvas : public wxGLCanvas |
8b089c5e | 77 | { |
bcc4c541 | 78 | public: |
5cf036d0 DS |
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 | ||
451c13c8 | 84 | virtual ~TestGLCanvas(); |
bcc4c541 | 85 | |
4b764db3 JS |
86 | void LoadDXF(const wxString& filename); |
87 | ||
88 | protected: | |
bcc4c541 RR |
89 | void OnPaint(wxPaintEvent& event); |
90 | void OnSize(wxSizeEvent& event); | |
91 | void OnEraseBackground(wxEraseEvent& event); | |
4b764db3 JS |
92 | void OnMouse(wxMouseEvent& event); |
93 | ||
94 | private: | |
5cf036d0 | 95 | void InitGL(); |
4b764db3 | 96 | void ResetProjectionMode(); |
5cf036d0 | 97 | |
451c13c8 VZ |
98 | wxGLContext* m_glRC; |
99 | GLData m_gldata; | |
100 | DXFRenderer m_renderer; | |
8b089c5e | 101 | |
c0c133e1 | 102 | wxDECLARE_NO_COPY_CLASS(TestGLCanvas); |
bcc4c541 | 103 | DECLARE_EVENT_TABLE() |
8b089c5e JS |
104 | }; |
105 | ||
5cf036d0 | 106 | #endif // #ifndef _WX_PENGUIN_H_ |