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