]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/glcanvas.h
fixing -fvisibility-inlines-hidden problem (IsOk function didn't get exported)
[wxWidgets.git] / include / wx / x11 / glcanvas.h
CommitLineData
83df96d6 1/////////////////////////////////////////////////////////////////////////////
b73e73f9 2// Name: wx/x11/glcanvas.h
77ffb593 3// Purpose: wxGLCanvas, for using OpenGL with wxWidgets 2.0 for Motif.
83df96d6
JS
4// Uses the GLX extension.
5// Author: Julian Smart and Wolfram Gloger
6// Modified by:
7// Created: 1995, 1999
8// RCS-ID: $Id$
9// Copyright: (c) Julian Smart, Wolfram Gloger
b73e73f9 10// Licence: wxWindows licence
83df96d6
JS
11/////////////////////////////////////////////////////////////////////////////
12
db4c39a9
VZ
13#ifndef _WX_GLCANVAS_H_
14#define _WX_GLCANVAS_H_
15
b73e73f9 16#include "wx/defs.h"
83df96d6
JS
17
18#if wxUSE_GLCANVAS
19
20#include "wx/gdicmn.h"
21#include "wx/palette.h"
22#include "wx/scrolwin.h"
23
24#include <GL/glx.h>
25
83df96d6
JS
26//---------------------------------------------------------------------------
27// classes
28//---------------------------------------------------------------------------
29
30
31class WXDLLEXPORT wxGLContext: public wxObject
32{
33public:
b73e73f9 34 wxGLContext( bool isRGB, wxWindow *win,
83df96d6 35 const wxPalette& palette = wxNullPalette );
b73e73f9 36 wxGLContext( bool WXUNUSED(isRGB), wxWindow *win,
83df96d6
JS
37 const wxPalette& WXUNUSED(palette),
38 const wxGLContext *other /* for sharing display lists */
39 );
d3c7fc99 40 virtual ~wxGLContext();
b73e73f9 41
83df96d6 42 void SetCurrent();
54385bdb 43 void SetColour(const wxChar *colour);
83df96d6 44 void SwapBuffers();
b73e73f9 45
83df96d6
JS
46 void SetupPixelFormat();
47 void SetupPalette(const wxPalette& palette);
48 wxPalette CreateDefaultPalette();
b73e73f9 49
83df96d6
JS
50 inline wxPalette* GetPalette() const { return (wxPalette*) & m_palette; }
51 inline wxWindow* GetWindow() const { return m_window; }
52 // inline GtkWidget* GetWidget() const { return m_widget; }
53 inline GLXContext GetContext() const { return m_glContext; }
b73e73f9 54
83df96d6
JS
55public:
56 GLXContext m_glContext;
b73e73f9 57
83df96d6
JS
58 // GtkWidget *m_widget;
59 wxPalette m_palette;
60 wxWindow* m_window;
b73e73f9 61
83df96d6
JS
62 DECLARE_CLASS(wxGLContext)
63};
64
65
66class WXDLLEXPORT wxGLCanvas: public wxScrolledWindow
67{
68public:
69 inline wxGLCanvas() {
70 m_glContext = (wxGLContext*) NULL;
71 m_sharedContext = (wxGLContext*) NULL;
72 // m_glWidget = (GtkWidget*) NULL;
73 m_vi = (void*) NULL;
74 // m_exposed = FALSE;
75 }
b73e73f9 76 wxGLCanvas( wxWindow *parent, wxWindowID id = wxID_ANY,
83df96d6 77 const wxPoint& pos = wxDefaultPosition,
b73e73f9
WS
78 const wxSize& size = wxDefaultSize,
79 long style = 0, const wxString& name = wxT("GLCanvas"),
80 int *attribList = (int*) NULL,
83df96d6 81 const wxPalette& palette = wxNullPalette );
a0573e8e 82 wxGLCanvas( wxWindow *parent, const wxGLContext *shared,
b73e73f9 83 wxWindowID id = wxID_ANY,
83df96d6 84 const wxPoint& pos = wxDefaultPosition,
b73e73f9
WS
85 const wxSize& size = wxDefaultSize,
86 long style = 0, const wxString& name = wxT("GLCanvas"),
87 int *attribList = (int*) NULL,
83df96d6 88 const wxPalette& palette = wxNullPalette );
a0573e8e 89 wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared,
b73e73f9 90 wxWindowID id = wxID_ANY,
83df96d6 91 const wxPoint& pos = wxDefaultPosition,
b73e73f9
WS
92 const wxSize& size = wxDefaultSize,
93 long style = 0, const wxString& name = wxT("GLCanvas"),
94 int *attribList = (int*) NULL,
83df96d6 95 const wxPalette& palette = wxNullPalette );
b73e73f9
WS
96
97 bool Create( wxWindow *parent,
83df96d6
JS
98 const wxGLContext *shared = (wxGLContext*)NULL,
99 const wxGLCanvas *shared_context_of = (wxGLCanvas*)NULL,
b73e73f9 100 wxWindowID id = wxID_ANY,
83df96d6 101 const wxPoint& pos = wxDefaultPosition,
b73e73f9
WS
102 const wxSize& size = wxDefaultSize,
103 long style = 0, const wxString& name = wxT("GLCanvas"),
83df96d6
JS
104 int *attribList = (int*) NULL,
105 const wxPalette& palette = wxNullPalette );
b73e73f9 106
d3c7fc99 107 virtual ~wxGLCanvas();
b73e73f9 108
83df96d6 109 void SetCurrent();
54385bdb 110 void SetColour(const wxChar *colour);
83df96d6 111 void SwapBuffers();
b73e73f9 112
83df96d6 113 // void OnSize(wxSizeEvent& event);
b73e73f9 114
83df96d6 115 // void OnInternalIdle();
b73e73f9
WS
116
117 inline wxGLContext* GetContext() const { return m_glContext; }
118
83df96d6 119 // implementation
b73e73f9 120
83df96d6
JS
121 wxGLContext *m_glContext,
122 *m_sharedContext;
123 wxGLCanvas *m_sharedContextOf;
124 void *m_vi;
125 // GtkWidget *m_glWidget;
126 // bool m_exposed;
b73e73f9 127
83df96d6
JS
128 DECLARE_EVENT_TABLE()
129 DECLARE_CLASS(wxGLCanvas)
b73e73f9 130
83df96d6
JS
131};
132
133#endif
134// wxUSE_GLCANVAS
135
136#endif
137// _WX_GLCANVAS_H_