]>
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"
28 WX_GL_RGBA
=1, /* use true color palette */
29 WX_GL_BUFFER_SIZE
, /* bits for buffer if not WX_GL_RGBA */
30 WX_GL_LEVEL
, /* 0 for main buffer, >0 for overlay, <0 for underlay */
31 WX_GL_DOUBLEBUFFER
, /* use doublebuffer */
32 WX_GL_STEREO
, /* use stereoscopic display */
33 WX_GL_AUX_BUFFERS
, /* number of auxiliary buffers */
34 WX_GL_MIN_RED
, /* use red buffer with most bits (> MIN_RED bits) */
35 WX_GL_MIN_GREEN
, /* use green buffer with most bits (> MIN_GREEN bits) */
36 WX_GL_MIN_BLUE
, /* use blue buffer with most bits (> MIN_BLUE bits) */
37 WX_GL_MIN_ALPHA
, /* use blue buffer with most bits (> MIN_ALPHA bits) */
38 WX_GL_DEPTH_SIZE
, /* bits for Z-buffer (0,16,32) */
39 WX_GL_STENCIL_SIZE
, /* bits for stencil buffer */
40 WX_GL_MIN_ACCUM_RED
, /* use red accum buffer with most bits (> MIN_ACCUM_RED bits) */
41 WX_GL_MIN_ACCUM_GREEN
, /* use green buffer with most bits (> MIN_ACCUM_GREEN bits) */
42 WX_GL_MIN_ACCUM_BLUE
, /* use blue buffer with most bits (> MIN_ACCUM_BLUE bits) */
43 WX_GL_MIN_ACCUM_ALPHA
/* use blue buffer with most bits (> MIN_ACCUM_ALPHA bits) */
46 //---------------------------------------------------------------------------
48 //---------------------------------------------------------------------------
51 class WXDLLEXPORT wxGLContext
: public wxObject
54 wxGLContext( bool isRGB
, wxWindow
*win
,
55 const wxPalette
& palette
= wxNullPalette
);
56 wxGLContext( bool WXUNUSED(isRGB
), wxWindow
*win
,
57 const wxPalette
& WXUNUSED(palette
),
58 const wxGLContext
*other
/* for sharing display lists */
63 void SetColour(const wxChar
*colour
);
66 void SetupPixelFormat();
67 void SetupPalette(const wxPalette
& palette
);
68 wxPalette
CreateDefaultPalette();
70 inline wxPalette
* GetPalette() const { return (wxPalette
*) & m_palette
; }
71 inline wxWindow
* GetWindow() const { return m_window
; }
72 // inline GtkWidget* GetWidget() const { return m_widget; }
73 inline GLXContext
GetContext() const { return m_glContext
; }
76 GLXContext m_glContext
;
78 // GtkWidget *m_widget;
82 DECLARE_CLASS(wxGLContext
)
86 class WXDLLEXPORT wxGLCanvas
: public wxScrolledWindow
90 m_glContext
= (wxGLContext
*) NULL
;
91 m_sharedContext
= (wxGLContext
*) NULL
;
92 // m_glWidget = (GtkWidget*) NULL;
96 wxGLCanvas( wxWindow
*parent
, wxWindowID id
= wxID_ANY
,
97 const wxPoint
& pos
= wxDefaultPosition
,
98 const wxSize
& size
= wxDefaultSize
,
99 long style
= 0, const wxString
& name
= wxT("GLCanvas"),
100 int *attribList
= (int*) NULL
,
101 const wxPalette
& palette
= wxNullPalette
);
102 wxGLCanvas( wxWindow
*parent
, const wxGLContext
*shared
,
103 wxWindowID id
= wxID_ANY
,
104 const wxPoint
& pos
= wxDefaultPosition
,
105 const wxSize
& size
= wxDefaultSize
,
106 long style
= 0, const wxString
& name
= wxT("GLCanvas"),
107 int *attribList
= (int*) NULL
,
108 const wxPalette
& palette
= wxNullPalette
);
109 wxGLCanvas( wxWindow
*parent
, const wxGLCanvas
*shared
,
110 wxWindowID id
= wxID_ANY
,
111 const wxPoint
& pos
= wxDefaultPosition
,
112 const wxSize
& size
= wxDefaultSize
,
113 long style
= 0, const wxString
& name
= wxT("GLCanvas"),
114 int *attribList
= (int*) NULL
,
115 const wxPalette
& palette
= wxNullPalette
);
117 bool Create( wxWindow
*parent
,
118 const wxGLContext
*shared
= (wxGLContext
*)NULL
,
119 const wxGLCanvas
*shared_context_of
= (wxGLCanvas
*)NULL
,
120 wxWindowID id
= wxID_ANY
,
121 const wxPoint
& pos
= wxDefaultPosition
,
122 const wxSize
& size
= wxDefaultSize
,
123 long style
= 0, const wxString
& name
= wxT("GLCanvas"),
124 int *attribList
= (int*) NULL
,
125 const wxPalette
& palette
= wxNullPalette
);
130 void SetColour(const wxChar
*colour
);
133 // void OnSize(wxSizeEvent& event);
135 // void OnInternalIdle();
137 inline wxGLContext
* GetContext() const { return m_glContext
; }
141 wxGLContext
*m_glContext
,
143 wxGLCanvas
*m_sharedContextOf
;
145 // GtkWidget *m_glWidget;
148 DECLARE_EVENT_TABLE()
149 DECLARE_CLASS(wxGLCanvas
)