]> git.saurik.com Git - wxWidgets.git/blame - samples/opengl/penguin/penguin.h
Include wx/containr.h according to precompiled headers of wx/wx.h (with other minor...
[wxWidgets.git] / samples / opengl / penguin / penguin.h
CommitLineData
8b089c5e
JS
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
2f6c54eb 9// Licence: wxWindows licence
8b089c5e
JS
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"
4b764db3
JS
20#include "wx/wfstream.h"
21#if wxUSE_ZLIB
22#include "wx/zstream.h"
23#endif
8b089c5e
JS
24
25#include "wx/glcanvas.h"
26
5cf036d0
DS
27extern "C"
28{
8b089c5e
JS
29#include "trackball.h"
30}
31
4b764db3 32#include "dxfrenderer.h"
8b089c5e 33
4b764db3
JS
34// OpenGL view data
35struct 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
4b764db3 43// Define a new application type
8b089c5e
JS
44class MyApp: public wxApp
45{
46public:
5cf036d0 47 bool OnInit();
8b089c5e
JS
48};
49
4b764db3 50// Define a new frame type
8b089c5e 51class TestGLCanvas;
bcc4c541 52
8b089c5e
JS
53class MyFrame: public wxFrame
54{
55public:
5cf036d0
DS
56 MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
57 const wxSize& size, long style = wxDEFAULT_FRAME_STYLE);
8b089c5e 58
4b764db3
JS
59 void OnMenuFileOpen(wxCommandEvent& event);
60 void OnMenuFileExit(wxCommandEvent& event);
61 void OnMenuHelpAbout(wxCommandEvent& event);
5cf036d0 62
2db98bf5 63#if wxUSE_GLCANVAS
5cf036d0
DS
64 void SetCanvas( TestGLCanvas *canvas ) { m_canvas = canvas; }
65 TestGLCanvas *GetCanvas() { return m_canvas; }
66
bcc4c541 67private:
5cf036d0 68 TestGLCanvas *m_canvas;
2db98bf5 69#endif
8b089c5e 70
bcc4c541 71 DECLARE_EVENT_TABLE()
8b089c5e
JS
72};
73
2db98bf5
JS
74#if wxUSE_GLCANVAS
75
8b089c5e
JS
76class TestGLCanvas: public wxGLCanvas
77{
bcc4c541 78public:
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
84 ~TestGLCanvas();
bcc4c541 85
4b764db3
JS
86 void LoadDXF(const wxString& filename);
87
88protected:
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
94private:
5cf036d0 95 void InitGL();
4b764db3 96 void ResetProjectionMode();
5cf036d0 97
4b764db3
JS
98 GLData m_gldata;
99 DXFRenderer m_renderer;
8b089c5e 100
bcc4c541 101 DECLARE_EVENT_TABLE()
8b089c5e
JS
102};
103
5cf036d0 104#endif // #if wxUSE_GLCANVAS
8b089c5e 105
5cf036d0 106#endif // #ifndef _WX_PENGUIN_H_
2db98bf5 107