]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/glcanvas.h
cleaning up problems after string changes
[wxWidgets.git] / include / wx / gtk1 / glcanvas.h
CommitLineData
8b089c5e 1/////////////////////////////////////////////////////////////////////////////
dc3065a5 2// Name: glcanvas.h
77ffb593 3// Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWidgets and GTK
8b089c5e
JS
4// Author: Robert Roebling
5// Modified by:
6// Created: 17/8/98
7// RCS-ID: $Id$
8// Copyright: (c) Robert Roebling
65571936 9// Licence: wxWindows licence
8b089c5e
JS
10/////////////////////////////////////////////////////////////////////////////
11
db4c39a9
VZ
12#ifndef _WX_GLCANVAS_H_
13#define _WX_GLCANVAS_H_
14
dc3065a5
VZ
15extern "C"
16{
17 #include <GL/gl.h>
18 #include <GL/glx.h>
19 #include <GL/glu.h>
8b089c5e
JS
20}
21
8b089c5e
JS
22//---------------------------------------------------------------------------
23// wxGLContext
24//---------------------------------------------------------------------------
25
26
dc3065a5 27class WXDLLEXPORT wxGLContext : public wxGLContextBase
8b089c5e
JS
28{
29public:
dc3065a5 30 wxGLContext(wxWindow* win, const wxGLContext* other = NULL);
d3c7fc99 31 virtual ~wxGLContext();
8b089c5e 32
dc3065a5 33 virtual void SetCurrent(const wxGLCanvas& win) const;
2b5f62a0 34
8b089c5e 35private:
dc3065a5
VZ
36 GLXContext m_glContext;
37
38 DECLARE_CLASS(wxGLContext)
8b089c5e
JS
39};
40
41//---------------------------------------------------------------------------
a6f5aa49 42// wxGLCanvas
8b089c5e
JS
43//---------------------------------------------------------------------------
44
dc3065a5 45class WXDLLEXPORT wxGLCanvas : public wxGLCanvasBase
8b089c5e
JS
46{
47public:
dc3065a5
VZ
48 wxGLCanvas(wxWindow *parent,
49 wxWindowID id = wxID_ANY,
50 const int *attribList = NULL,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 long style = 0,
54 const wxString& name = wxGLCanvasName,
55 const wxPalette& palette = wxNullPalette);
56
57 bool Create(wxWindow *parent,
58 wxWindowID id = wxID_ANY,
2b5f62a0
VZ
59 const wxPoint& pos = wxDefaultPosition,
60 const wxSize& size = wxDefaultSize,
61 long style = 0,
62 const wxString& name = wxGLCanvasName,
dc3065a5
VZ
63 const int *attribList = NULL,
64 const wxPalette& palette = wxNullPalette);
2b5f62a0 65
dc3065a5 66 virtual ~wxGLCanvas();
8b089c5e 67
8b089c5e 68
dc3065a5
VZ
69 // implement wxGLCanvasBase methods
70 // --------------------------------
2b5f62a0 71
dc3065a5 72 virtual void SwapBuffers();
8b089c5e 73
8b089c5e 74
dc3065a5
VZ
75 // GTK-specific helpers
76 // --------------------
77
78 // return GLX version: 13 means 1.3
79 static int GetGLXVersion();
80
81
82 // deprecated methods
83 // ------------------
84
85#if WXWIN_COMPATIBILITY_2_8
86 wxDEPRECATED(
87 wxGLCanvas(wxWindow *parent,
88 wxWindowID id = wxID_ANY,
89 const wxPoint& pos = wxDefaultPosition,
90 const wxSize& size = wxDefaultSize,
91 long style = 0,
92 const wxString& name = wxGLCanvasName,
93 const int *attribList = NULL,
94 const wxPalette& palette = wxNullPalette)
95 );
96
97 wxDEPRECATED(
98 wxGLCanvas(wxWindow *parent,
99 const wxGLContext *shared,
100 wxWindowID id = wxID_ANY,
101 const wxPoint& pos = wxDefaultPosition,
102 const wxSize& size = wxDefaultSize,
103 long style = 0,
104 const wxString& name = wxGLCanvasName,
105 const int *attribList = NULL,
106 const wxPalette& palette = wxNullPalette)
107 );
108
109 wxDEPRECATED(
110 wxGLCanvas(wxWindow *parent,
111 const wxGLCanvas *shared,
112 wxWindowID id = wxID_ANY,
113 const wxPoint& pos = wxDefaultPosition,
114 const wxSize& size = wxDefaultSize,
115 long style = 0,
116 const wxString& name = wxGLCanvasName,
117 const int *attribList = NULL,
118 const wxPalette& palette = wxNullPalette)
119 );
120
121 // called from "realized" callback to create the implicit context if needed
122 void GTKInitImplicitContext();
123#endif // WXWIN_COMPATIBILITY_2_8
124
125 // implementation from now on
126 virtual void OnInternalIdle();
127
2b5f62a0 128
a6f5aa49 129 void *m_vi; // actually an XVisualInfo*
34a34b02 130 GLXFBConfig *m_fbc;
a6f5aa49 131 bool m_canFreeVi;
34a34b02 132 bool m_canFreeFBC;
8b089c5e 133 GtkWidget *m_glWidget;
dc3065a5
VZ
134
135#if WXWIN_COMPATIBILITY_2_8
136 wxGLContext *m_sharedContext;
137 wxGLCanvas *m_sharedContextOf;
138 const bool m_createImplicitContext;
139#endif // WXWIN_COMPATIBILITY_2_8
2b5f62a0 140
a6f5aa49
VZ
141 // returns an XVisualInfo* based on desired GL attributes;
142 // returns NULL if an appropriate visual is not found. The
2b5f62a0 143 // caller is reponsible for using XFree() to deallocate
a6f5aa49 144 // the returned structure.
dc3065a5
VZ
145 static void* ChooseGLVisual(const int *attribList);
146 static void* ChooseGLFBC(const int *attribList);
147 static void GetGLAttribListFromWX(const int *wx_attribList, int *gl_attribList );
8b089c5e
JS
148
149private:
8b089c5e
JS
150 DECLARE_CLASS(wxGLCanvas)
151};
152
dc3065a5 153#endif // _WX_GLCANVAS_H_
8b089c5e 154