]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/glcanvas.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWidgets and GTK
4 // Author: Robert Roebling
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GLCANVAS_H_
13 #define _WX_GLCANVAS_H_
22 //---------------------------------------------------------------------------
24 //---------------------------------------------------------------------------
27 class WXDLLEXPORT wxGLContext
: public wxGLContextBase
30 wxGLContext(wxWindow
* win
, const wxGLContext
* other
= NULL
);
31 virtual ~wxGLContext();
33 virtual void SetCurrent(const wxGLCanvas
& win
) const;
36 GLXContext m_glContext
;
38 DECLARE_CLASS(wxGLContext
)
41 //---------------------------------------------------------------------------
43 //---------------------------------------------------------------------------
45 class WXDLLEXPORT wxGLCanvas
: public wxGLCanvasBase
48 wxGLCanvas(wxWindow
*parent
,
49 wxWindowID id
= wxID_ANY
,
50 const int *attribList
= NULL
,
51 const wxPoint
& pos
= wxDefaultPosition
,
52 const wxSize
& size
= wxDefaultSize
,
54 const wxString
& name
= wxGLCanvasName
,
55 const wxPalette
& palette
= wxNullPalette
);
57 bool Create(wxWindow
*parent
,
58 wxWindowID id
= wxID_ANY
,
59 const wxPoint
& pos
= wxDefaultPosition
,
60 const wxSize
& size
= wxDefaultSize
,
62 const wxString
& name
= wxGLCanvasName
,
63 const int *attribList
= NULL
,
64 const wxPalette
& palette
= wxNullPalette
);
66 virtual ~wxGLCanvas();
69 // implement wxGLCanvasBase methods
70 // --------------------------------
72 virtual void SwapBuffers();
75 // GTK-specific helpers
76 // --------------------
78 // return GLX version: 13 means 1.3
79 static int GetGLXVersion();
85 #if WXWIN_COMPATIBILITY_2_8
87 wxGLCanvas(wxWindow
*parent
,
88 wxWindowID id
= wxID_ANY
,
89 const wxPoint
& pos
= wxDefaultPosition
,
90 const wxSize
& size
= wxDefaultSize
,
92 const wxString
& name
= wxGLCanvasName
,
93 const int *attribList
= NULL
,
94 const wxPalette
& palette
= wxNullPalette
)
98 wxGLCanvas(wxWindow
*parent
,
99 const wxGLContext
*shared
,
100 wxWindowID id
= wxID_ANY
,
101 const wxPoint
& pos
= wxDefaultPosition
,
102 const wxSize
& size
= wxDefaultSize
,
104 const wxString
& name
= wxGLCanvasName
,
105 const int *attribList
= NULL
,
106 const wxPalette
& palette
= wxNullPalette
)
110 wxGLCanvas(wxWindow
*parent
,
111 const wxGLCanvas
*shared
,
112 wxWindowID id
= wxID_ANY
,
113 const wxPoint
& pos
= wxDefaultPosition
,
114 const wxSize
& size
= wxDefaultSize
,
116 const wxString
& name
= wxGLCanvasName
,
117 const int *attribList
= NULL
,
118 const wxPalette
& palette
= wxNullPalette
)
121 // called from "realized" callback to create the implicit context if needed
122 void GTKInitImplicitContext();
123 #endif // WXWIN_COMPATIBILITY_2_8
125 // implementation from now on
126 virtual void OnInternalIdle();
129 void *m_vi
; // actually an XVisualInfo*
133 GtkWidget
*m_glWidget
;
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
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
);
150 DECLARE_CLASS(wxGLCanvas
)
153 #endif // _WX_GLCANVAS_H_