]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/gtk1/glcanvas.h
add aglUpdateContext() call (doesn't seem to change anything but should be there...
[wxWidgets.git] / include / wx / gtk1 / glcanvas.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: glcanvas.h
3// Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWidgets 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#ifndef _WX_GLCANVAS_H_
13#define _WX_GLCANVAS_H_
14
15extern "C"
16{
17 #include <GL/gl.h>
18 #include <GL/glx.h>
19 #include <GL/glu.h>
20}
21
22//---------------------------------------------------------------------------
23// wxGLContext
24//---------------------------------------------------------------------------
25
26
27class WXDLLEXPORT wxGLContext : public wxGLContextBase
28{
29public:
30 wxGLContext(wxWindow* win, const wxGLContext* other = NULL);
31 virtual ~wxGLContext();
32
33 virtual void SetCurrent(const wxGLCanvas& win) const;
34
35private:
36 GLXContext m_glContext;
37
38 DECLARE_CLASS(wxGLContext)
39};
40
41//---------------------------------------------------------------------------
42// wxGLCanvas
43//---------------------------------------------------------------------------
44
45class WXDLLEXPORT wxGLCanvas : public wxGLCanvasBase
46{
47public:
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,
59 const wxPoint& pos = wxDefaultPosition,
60 const wxSize& size = wxDefaultSize,
61 long style = 0,
62 const wxString& name = wxGLCanvasName,
63 const int *attribList = NULL,
64 const wxPalette& palette = wxNullPalette);
65
66 virtual ~wxGLCanvas();
67
68
69 // implement wxGLCanvasBase methods
70 // --------------------------------
71
72 virtual void SwapBuffers();
73
74
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
128
129 void *m_vi; // actually an XVisualInfo*
130 GLXFBConfig *m_fbc;
131 bool m_canFreeVi;
132 bool m_canFreeFBC;
133 GtkWidget *m_glWidget;
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
140
141 // returns an XVisualInfo* based on desired GL attributes;
142 // returns NULL if an appropriate visual is not found. The
143 // caller is reponsible for using XFree() to deallocate
144 // the returned structure.
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 );
148
149private:
150 DECLARE_CLASS(wxGLCanvas)
151};
152
153#endif // _WX_GLCANVAS_H_
154