]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/glcanvas.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/x11/glcanvas.h
3 // Purpose: wxGLCanvas, for using OpenGL with wxWidgets 2.0 for Motif.
4 // Uses the GLX extension.
5 // Author: Julian Smart and Wolfram Gloger
9 // Copyright: (c) Julian Smart, Wolfram Gloger
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_GLCANVAS_H_
14 #define _WX_GLCANVAS_H_
20 #include "wx/gdicmn.h"
21 #include "wx/palette.h"
22 #include "wx/scrolwin.h"
26 //---------------------------------------------------------------------------
28 //---------------------------------------------------------------------------
31 class WXDLLEXPORT wxGLContext
: public wxObject
34 wxGLContext( bool isRGB
, wxWindow
*win
,
35 const wxPalette
& palette
= wxNullPalette
);
36 wxGLContext( bool WXUNUSED(isRGB
), wxWindow
*win
,
37 const wxPalette
& WXUNUSED(palette
),
38 const wxGLContext
*other
/* for sharing display lists */
40 virtual ~wxGLContext();
43 void SetColour(const wxChar
*colour
);
46 void SetupPixelFormat();
47 void SetupPalette(const wxPalette
& palette
);
48 wxPalette
CreateDefaultPalette();
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
; }
56 GLXContext m_glContext
;
58 // GtkWidget *m_widget;
62 DECLARE_CLASS(wxGLContext
)
66 class WXDLLEXPORT wxGLCanvas
: public wxScrolledWindow
70 m_glContext
= (wxGLContext
*) NULL
;
71 m_sharedContext
= (wxGLContext
*) NULL
;
72 // m_glWidget = (GtkWidget*) NULL;
76 wxGLCanvas( wxWindow
*parent
, wxWindowID id
= wxID_ANY
,
77 const wxPoint
& pos
= wxDefaultPosition
,
78 const wxSize
& size
= wxDefaultSize
,
79 long style
= 0, const wxString
& name
= wxT("GLCanvas"),
80 int *attribList
= (int*) NULL
,
81 const wxPalette
& palette
= wxNullPalette
);
82 wxGLCanvas( wxWindow
*parent
, const wxGLContext
*shared
,
83 wxWindowID id
= wxID_ANY
,
84 const wxPoint
& pos
= wxDefaultPosition
,
85 const wxSize
& size
= wxDefaultSize
,
86 long style
= 0, const wxString
& name
= wxT("GLCanvas"),
87 int *attribList
= (int*) NULL
,
88 const wxPalette
& palette
= wxNullPalette
);
89 wxGLCanvas( wxWindow
*parent
, const wxGLCanvas
*shared
,
90 wxWindowID id
= wxID_ANY
,
91 const wxPoint
& pos
= wxDefaultPosition
,
92 const wxSize
& size
= wxDefaultSize
,
93 long style
= 0, const wxString
& name
= wxT("GLCanvas"),
94 int *attribList
= (int*) NULL
,
95 const wxPalette
& palette
= wxNullPalette
);
97 bool Create( wxWindow
*parent
,
98 const wxGLContext
*shared
= (wxGLContext
*)NULL
,
99 const wxGLCanvas
*shared_context_of
= (wxGLCanvas
*)NULL
,
100 wxWindowID id
= wxID_ANY
,
101 const wxPoint
& pos
= wxDefaultPosition
,
102 const wxSize
& size
= wxDefaultSize
,
103 long style
= 0, const wxString
& name
= wxT("GLCanvas"),
104 int *attribList
= (int*) NULL
,
105 const wxPalette
& palette
= wxNullPalette
);
107 virtual ~wxGLCanvas();
110 void SetColour(const wxChar
*colour
);
113 // void OnSize(wxSizeEvent& event);
115 // void OnInternalIdle();
117 inline wxGLContext
* GetContext() const { return m_glContext
; }
121 wxGLContext
*m_glContext
,
123 wxGLCanvas
*m_sharedContextOf
;
125 // GtkWidget *m_glWidget;
128 DECLARE_EVENT_TABLE()
129 DECLARE_CLASS(wxGLCanvas
)