]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/glcanvas.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWindows and GTK
4 // Author: Robert Roebling
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma interface "glcanvas.h"
16 #ifndef _WX_GLCANVAS_H_
17 #define _WX_GLCANVAS_H_
23 #include <wx/scrolwin.h>
31 //---------------------------------------------------------------------------
32 // Constants for attriblist
33 //---------------------------------------------------------------------------
37 WX_GL_RGBA
=1, /* use true color palette */
38 WX_GL_BUFFER_SIZE
, /* bits for buffer if not WX_GL_RGBA */
39 WX_GL_LEVEL
, /* 0 for main buffer, >0 for overlay, <0 for underlay */
40 WX_GL_DOUBLEBUFFER
, /* use doublebuffer */
41 WX_GL_STEREO
, /* use stereoscopic display */
42 WX_GL_AUX_BUFFERS
, /* number of auxiliary buffers */
43 WX_GL_MIN_RED
, /* use red buffer with most bits (> MIN_RED bits) */
44 WX_GL_MIN_GREEN
, /* use green buffer with most bits (> MIN_GREEN bits) */
45 WX_GL_MIN_BLUE
, /* use blue buffer with most bits (> MIN_BLUE bits) */
46 WX_GL_MIN_ALPHA
, /* use blue buffer with most bits (> MIN_ALPHA bits) */
47 WX_GL_DEPTH_SIZE
, /* bits for Z-buffer (0,16,32) */
48 WX_GL_STENCIL_SIZE
, /* bits for stencil buffer */
49 WX_GL_MIN_ACCUM_RED
, /* use red accum buffer with most bits (> MIN_ACCUM_RED bits) */
50 WX_GL_MIN_ACCUM_GREEN
, /* use green buffer with most bits (> MIN_ACCUM_GREEN bits) */
51 WX_GL_MIN_ACCUM_BLUE
, /* use blue buffer with most bits (> MIN_ACCUM_BLUE bits) */
52 WX_GL_MIN_ACCUM_ALPHA
/* use blue buffer with most bits (> MIN_ACCUM_ALPHA bits) */
55 //---------------------------------------------------------------------------
57 //---------------------------------------------------------------------------
59 class WXDLLEXPORT wxGLContext
;
60 class WXDLLEXPORT wxGLCanvas
;
62 //---------------------------------------------------------------------------
64 //---------------------------------------------------------------------------
67 class WXDLLEXPORT wxGLContext
: public wxObject
70 wxGLContext( bool isRGB
, wxWindow
*win
, const wxPalette
& palette
= wxNullPalette
);
72 bool WXUNUSED(isRGB
), wxWindow
*win
,
73 const wxPalette
& WXUNUSED(palette
),
74 const wxGLContext
*other
/* for sharing display lists */
79 void SetColour(const char *colour
);
82 void SetupPixelFormat();
83 void SetupPalette(const wxPalette
& palette
);
84 wxPalette
CreateDefaultPalette();
86 inline wxPalette
* GetPalette() const { return (wxPalette
*) & m_palette
; }
87 inline wxWindow
* GetWindow() const { return m_window
; }
88 inline GtkWidget
* GetWidget() const { return m_widget
; }
89 inline GLXContext
GetContext() const { return m_glContext
; }
92 GLXContext m_glContext
;
99 DECLARE_CLASS(wxGLContext
)
102 //---------------------------------------------------------------------------
104 //---------------------------------------------------------------------------
106 class WXDLLEXPORT wxGLCanvas
: public wxScrolledWindow
109 inline wxGLCanvas() {
110 m_glContext
= (wxGLContext
*) NULL
;
111 m_sharedContext
= (wxGLContext
*) NULL
;
112 m_glWidget
= (GtkWidget
*) NULL
;
116 wxGLCanvas( wxWindow
*parent
, wxWindowID id
= -1,
117 const wxPoint
& pos
= wxDefaultPosition
,
118 const wxSize
& size
= wxDefaultSize
,
119 long style
= 0, const wxString
& name
= "GLCanvas",
120 int *attribList
= (int*) NULL
,
121 const wxPalette
& palette
= wxNullPalette
);
122 wxGLCanvas( wxWindow
*parent
, const wxGLContext
*shared
= (wxGLContext
*)NULL
,
124 const wxPoint
& pos
= wxDefaultPosition
,
125 const wxSize
& size
= wxDefaultSize
,
126 long style
= 0, const wxString
& name
= "GLCanvas",
127 int *attribList
= (int*) NULL
,
128 const wxPalette
& palette
= wxNullPalette
);
129 wxGLCanvas( wxWindow
*parent
, const wxGLCanvas
*shared
= (wxGLCanvas
*)NULL
,
131 const wxPoint
& pos
= wxDefaultPosition
,
132 const wxSize
& size
= wxDefaultSize
,
133 long style
= 0, const wxString
& name
= "GLCanvas",
134 int *attribList
= (int*) NULL
,
135 const wxPalette
& palette
= wxNullPalette
);
137 bool Create( wxWindow
*parent
,
138 const wxGLContext
*shared
= (wxGLContext
*)NULL
,
139 const wxGLCanvas
*shared_context_of
= (wxGLCanvas
*)NULL
,
141 const wxPoint
& pos
= wxDefaultPosition
,
142 const wxSize
& size
= wxDefaultSize
,
143 long style
= 0, const wxString
& name
= "GLCanvas",
144 int *attribList
= (int*) NULL
,
145 const wxPalette
& palette
= wxNullPalette
);
150 void SetColour(const char *colour
);
153 void OnSize(wxSizeEvent
& event
);
155 void OnInternalIdle();
157 inline wxGLContext
* GetContext() const { return m_glContext
; }
161 wxGLContext
*m_glContext
,
163 wxGLCanvas
*m_sharedContextOf
;
165 GtkWidget
*m_glWidget
;
169 DECLARE_EVENT_TABLE()
170 DECLARE_CLASS(wxGLCanvas
)