]> git.saurik.com Git - wxWidgets.git/blame - samples/opengl/isosurf/isosurf.h
XRC: make wxStaticText's wrap property a dimension.
[wxWidgets.git] / samples / opengl / isosurf / isosurf.h
CommitLineData
8b089c5e
JS
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
8b089c5e 7// Copyright: (c) Julian Smart
2f6c54eb 8// Licence: wxWindows licence
8b089c5e
JS
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_ISOSURF_H_
12#define _WX_ISOSURF_H_
13
6c7f0949
FM
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
8b089c5e 32// Define a new application type
451c13c8 33class MyApp : public wxApp
5cf036d0
DS
34{
35public:
451c13c8 36 virtual bool OnInit();
6c7f0949
FM
37
38 virtual void OnInitCmdLine(wxCmdLineParser& parser);
39 virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
8b089c5e
JS
40};
41
5cf036d0 42
6c7f0949 43// The OpenGL-enabled canvas
451c13c8 44class TestGLCanvas : public wxGLCanvas
8b089c5e 45{
5cf036d0 46public:
451c13c8
VZ
47 TestGLCanvas(wxWindow *parent,
48 wxWindowID id = wxID_ANY,
451c13c8 49 int *gl_attrib = NULL);
8b089c5e 50
451c13c8 51 virtual ~TestGLCanvas();
5cf036d0
DS
52
53 void OnPaint(wxPaintEvent& event);
54 void OnSize(wxSizeEvent& event);
5cf036d0
DS
55 void OnChar(wxKeyEvent& event);
56 void OnMouseEvent(wxMouseEvent& event);
57
6c7f0949
FM
58 void LoadSurface(const wxString& filename);
59 void InitMaterials();
60 void InitGL();
451c13c8
VZ
61
62private:
63 wxGLContext* m_glRC;
64
6c7f0949
FM
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
c0c133e1 72 wxDECLARE_NO_COPY_CLASS(TestGLCanvas);
5cf036d0 73 DECLARE_EVENT_TABLE()
8b089c5e 74};
5cf036d0 75
8b089c5e 76
6c7f0949 77// The frame containing the GL canvas
451c13c8 78class MyFrame : public wxFrame
8b089c5e
JS
79{
80public:
451c13c8
VZ
81 MyFrame(wxFrame *frame,
82 const wxString& title,
0c1c1c71
FM
83 const wxPoint& pos = wxDefaultPosition,
84 const wxSize& size = wxDefaultSize,
451c13c8 85 long style = wxDEFAULT_FRAME_STYLE);
5cf036d0
DS
86
87 virtual ~MyFrame();
8b089c5e 88
5cf036d0 89 TestGLCanvas *m_canvas;
8b089c5e 90
5cf036d0 91private :
5cf036d0
DS
92 void OnExit(wxCommandEvent& event);
93
451c13c8 94 DECLARE_EVENT_TABLE()
8b089c5e
JS
95};
96
6c7f0949 97
451c13c8 98#endif // _WX_ISOSURF_H_
8b089c5e 99