]> git.saurik.com Git - wxWidgets.git/blob - samples/opengl/isosurf/isosurf.h
fix command line parsing
[wxWidgets.git] / samples / opengl / isosurf / isosurf.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: isosurf.h
3 // Purpose: wxGLCanvas demo program
4 // Author: Brian Paul (original gltk version), Wolfram Gloger
5 // Modified by: Julian Smart
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_ISOSURF_H_
13 #define _WX_ISOSURF_H_
14
15 // we need OpenGL headers for GLfloat/GLint types used below
16 #if defined(__WXMAC__) || defined(__WXCOCOA__)
17 # ifdef __DARWIN__
18 # include <OpenGL/gl.h>
19 # include <OpenGL/glu.h>
20 # else
21 # include <gl.h>
22 # include <glu.h>
23 # endif
24 #else
25 # include <GL/gl.h>
26 # include <GL/glu.h>
27 #endif
28
29 // the maximum number of vertex in the loaded .dat file
30 #define MAXVERTS 10000
31
32
33 // Define a new application type
34 class MyApp : public wxApp
35 {
36 public:
37 virtual bool OnInit();
38
39 virtual void OnInitCmdLine(wxCmdLineParser& parser);
40 virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
41 };
42
43
44 // The OpenGL-enabled canvas
45 class TestGLCanvas : public wxGLCanvas
46 {
47 public:
48 TestGLCanvas(wxWindow *parent,
49 wxWindowID id = wxID_ANY,
50 const wxPoint& pos = wxDefaultPosition,
51 const wxSize& size = wxDefaultSize,
52 long style = 0,
53 const wxString& name = _T("TestGLCanvas"),
54 int *gl_attrib = NULL);
55
56 virtual ~TestGLCanvas();
57
58 void OnPaint(wxPaintEvent& event);
59 void OnSize(wxSizeEvent& event);
60 void OnChar(wxKeyEvent& event);
61 void OnMouseEvent(wxMouseEvent& event);
62
63 void LoadSurface(const wxString& filename);
64 void InitMaterials();
65 void InitGL();
66
67 private:
68 wxGLContext* m_glRC;
69
70 GLfloat m_verts[MAXVERTS][3];
71 GLfloat m_norms[MAXVERTS][3];
72 GLint m_numverts;
73
74 GLfloat m_xrot;
75 GLfloat m_yrot;
76
77 DECLARE_NO_COPY_CLASS(TestGLCanvas)
78 DECLARE_EVENT_TABLE()
79 };
80
81
82 // The frame containing the GL canvas
83 class MyFrame : public wxFrame
84 {
85 public:
86 MyFrame(wxFrame *frame,
87 const wxString& title,
88 const wxPoint& pos,
89 const wxSize& size,
90 long style = wxDEFAULT_FRAME_STYLE);
91
92 virtual ~MyFrame();
93
94 TestGLCanvas *m_canvas;
95
96 private :
97 void OnExit(wxCommandEvent& event);
98
99 DECLARE_EVENT_TABLE()
100 };
101
102
103 #endif // _WX_ISOSURF_H_
104