]> git.saurik.com Git - wxWidgets.git/blame - utils/glcanvas/src/glcanvas.h
ODBC updates (it almost works now)
[wxWidgets.git] / utils / glcanvas / src / glcanvas.h
CommitLineData
9d3221ab
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: glcanvas.h
3// Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWindows and GTK
4// Author: Robert Roebling
5// Modified by:
6// Created: 17/8/98
7// RCS-ID: $Id$
8// Copyright: (c) Robert Roebling
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma interface "glcanvas.h"
14#endif
15
16#ifndef _WX_GLCANVAS_H_
17#define _WX_GLCANVAS_H_
18
19#include "wx/defs.h"
20#include "wx/scrolwin.h"
21
22#include "GL/gl.h"
23#include "GL/glx.h"
24#include "GL/glu.h"
25
26//---------------------------------------------------------------------------
27// classes
28//---------------------------------------------------------------------------
29
30class wxGLContext;
31class wxGLCanvas;
32
33//---------------------------------------------------------------------------
34// wxGLContext
35//---------------------------------------------------------------------------
36
37
38class wxGLContext: public wxObject
39{
40 DECLARE_CLASS(wxGLContext)
41
42 public:
43
44 wxGLContext( bool isRGB, wxWindow *win, const wxPalette& palette = wxNullPalette );
45 ~wxGLContext();
46
47 void SetCurrent();
48 void SetColour(const char *colour);
49 void SwapBuffers();
50
51 void SetupPixelFormat();
52 void SetupPalette(const wxPalette& palette);
53 wxPalette CreateDefaultPalette();
54
55 inline wxPalette* GetPalette() const { return (wxPalette*) & m_palette; }
56 inline wxWindow* GetWindow() const { return m_window; }
57 inline GtkWidget* GetWidget() const { return m_widget; }
58 inline GLXContext GetContext() const { return m_glContext; }
59
60 public:
61
62 GLXContext m_glContext;
63
64 GtkWidget *m_widget;
65 wxPalette m_palette;
66 wxWindow* m_window;
67};
68
69//---------------------------------------------------------------------------
70// wxGLContext
71//---------------------------------------------------------------------------
72
73class wxGLCanvas: public wxScrolledWindow
74{
75 DECLARE_CLASS(wxGLCanvas)
76
77 public:
78 wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
79 const wxSize& size = wxDefaultSize, long style = 0,
80 const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette);
81 ~wxGLCanvas();
82
83 void SetCurrent();
84 void SetColour(const char *colour);
85 void SwapBuffers();
86
87 void OnSize(wxSizeEvent& event);
88
89 inline wxGLContext* GetContext() const { return m_glContext; }
90
91 protected:
92
93 wxGLContext* m_glContext; // this is typedef-ed ptr, in fact
94
95 DECLARE_EVENT_TABLE()
96};
97
98#endif