fix the loading of the isosurf data; it was not loaded correctly on my system because...
[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 int *gl_attrib = NULL);
51
52 virtual ~TestGLCanvas();
53
54 void OnPaint(wxPaintEvent& event);
55 void OnSize(wxSizeEvent& event);
56 void OnChar(wxKeyEvent& event);
57 void OnMouseEvent(wxMouseEvent& event);
58
59 void LoadSurface(const wxString& filename);
60 void InitMaterials();
61 void InitGL();
62
63 private:
64 wxGLContext* m_glRC;
65
66 GLfloat m_verts[MAXVERTS][3];
67 GLfloat m_norms[MAXVERTS][3];
68 GLint m_numverts;
69
70 GLfloat m_xrot;
71 GLfloat m_yrot;
72
73 DECLARE_NO_COPY_CLASS(TestGLCanvas)
74 DECLARE_EVENT_TABLE()
75 };
76
77
78 // The frame containing the GL canvas
79 class MyFrame : public wxFrame
80 {
81 public:
82 MyFrame(wxFrame *frame,
83 const wxString& title,
84 const wxPoint& pos = wxDefaultPosition,
85 const wxSize& size = wxDefaultSize,
86 long style = wxDEFAULT_FRAME_STYLE);
87
88 virtual ~MyFrame();
89
90 TestGLCanvas *m_canvas;
91
92 private :
93 void OnExit(wxCommandEvent& event);
94
95 DECLARE_EVENT_TABLE()
96 };
97
98
99 #endif // _WX_ISOSURF_H_
100