2000-02-28 03:22:57 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: isosurf.h
|
|
|
|
// Purpose: wxGLCanvas demo program
|
|
|
|
// Author: Brian Paul (original gltk version), Wolfram Gloger
|
|
|
|
// Modified by: Julian Smart
|
|
|
|
// Created: 04/01/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
2002-03-17 09:16:03 -05:00
|
|
|
// Licence: wxWindows licence
|
2000-02-28 03:22:57 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_ISOSURF_H_
|
|
|
|
#define _WX_ISOSURF_H_
|
|
|
|
|
2008-12-12 15:42:51 -05:00
|
|
|
// we need OpenGL headers for GLfloat/GLint types used below
|
|
|
|
#if defined(__WXMAC__) || defined(__WXCOCOA__)
|
|
|
|
# ifdef __DARWIN__
|
|
|
|
# include <OpenGL/gl.h>
|
|
|
|
# include <OpenGL/glu.h>
|
|
|
|
# else
|
|
|
|
# include <gl.h>
|
|
|
|
# include <glu.h>
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# include <GL/gl.h>
|
|
|
|
# include <GL/glu.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// the maximum number of vertex in the loaded .dat file
|
|
|
|
#define MAXVERTS 10000
|
|
|
|
|
|
|
|
|
2000-02-28 03:22:57 -05:00
|
|
|
// Define a new application type
|
2008-02-10 08:26:01 -05:00
|
|
|
class MyApp : public wxApp
|
2003-11-14 23:21:10 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-02-10 08:26:01 -05:00
|
|
|
virtual bool OnInit();
|
2008-12-12 15:42:51 -05:00
|
|
|
|
|
|
|
virtual void OnInitCmdLine(wxCmdLineParser& parser);
|
|
|
|
virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
|
2000-02-28 03:22:57 -05:00
|
|
|
};
|
|
|
|
|
2003-11-14 23:21:10 -05:00
|
|
|
|
2008-12-12 15:42:51 -05:00
|
|
|
// The OpenGL-enabled canvas
|
2008-02-10 08:26:01 -05:00
|
|
|
class TestGLCanvas : public wxGLCanvas
|
2000-02-28 03:22:57 -05:00
|
|
|
{
|
2003-11-14 23:21:10 -05:00
|
|
|
public:
|
2008-02-10 08:26:01 -05:00
|
|
|
TestGLCanvas(wxWindow *parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
int *gl_attrib = NULL);
|
2000-02-28 03:22:57 -05:00
|
|
|
|
2008-02-10 08:26:01 -05:00
|
|
|
virtual ~TestGLCanvas();
|
2003-11-14 23:21:10 -05:00
|
|
|
|
|
|
|
void OnPaint(wxPaintEvent& event);
|
|
|
|
void OnSize(wxSizeEvent& event);
|
|
|
|
void OnChar(wxKeyEvent& event);
|
|
|
|
void OnMouseEvent(wxMouseEvent& event);
|
|
|
|
|
2008-12-12 15:42:51 -05:00
|
|
|
void LoadSurface(const wxString& filename);
|
|
|
|
void InitMaterials();
|
|
|
|
void InitGL();
|
2008-02-10 08:26:01 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
wxGLContext* m_glRC;
|
|
|
|
|
2008-12-12 15:42:51 -05:00
|
|
|
GLfloat m_verts[MAXVERTS][3];
|
|
|
|
GLfloat m_norms[MAXVERTS][3];
|
|
|
|
GLint m_numverts;
|
|
|
|
|
|
|
|
GLfloat m_xrot;
|
|
|
|
GLfloat m_yrot;
|
|
|
|
|
2008-02-10 08:26:01 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(TestGLCanvas)
|
2003-11-14 23:21:10 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
2000-02-28 03:22:57 -05:00
|
|
|
};
|
2003-11-14 23:21:10 -05:00
|
|
|
|
2000-02-28 03:22:57 -05:00
|
|
|
|
2008-12-12 15:42:51 -05:00
|
|
|
// The frame containing the GL canvas
|
2008-02-10 08:26:01 -05:00
|
|
|
class MyFrame : public wxFrame
|
2000-02-28 03:22:57 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-02-10 08:26:01 -05:00
|
|
|
MyFrame(wxFrame *frame,
|
|
|
|
const wxString& title,
|
2008-12-14 11:13:29 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2008-02-10 08:26:01 -05:00
|
|
|
long style = wxDEFAULT_FRAME_STYLE);
|
2003-11-14 23:21:10 -05:00
|
|
|
|
|
|
|
virtual ~MyFrame();
|
2000-02-28 03:22:57 -05:00
|
|
|
|
2003-11-14 23:21:10 -05:00
|
|
|
TestGLCanvas *m_canvas;
|
2000-02-28 03:22:57 -05:00
|
|
|
|
2003-11-14 23:21:10 -05:00
|
|
|
private :
|
|
|
|
void OnExit(wxCommandEvent& event);
|
|
|
|
|
2008-02-10 08:26:01 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
2000-02-28 03:22:57 -05:00
|
|
|
};
|
|
|
|
|
2008-12-12 15:42:51 -05:00
|
|
|
|
2008-02-10 08:26:01 -05:00
|
|
|
#endif // _WX_ISOSURF_H_
|
2000-02-28 03:22:57 -05:00
|
|
|
|