]>
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_DEPTH_SIZE
, /* bits for Z-buffer (0,16,32) */
39 WX_GL_DOUBLEBUFFER
, /* use doublebuffer */
40 WX_GL_MIN_RED
, /* use red buffer with most bits (> MIN_RED bits) */
41 WX_GL_MIN_GREEN
, /* use green buffer with most bits (> MIN_GREEN bits) */
42 WX_GL_MIN_BLUE
/* use blue buffer with most bits (> MIN_BLUE bits) */
43 /* these are enough constants for now, the remaining will be added later */
46 //---------------------------------------------------------------------------
48 //---------------------------------------------------------------------------
50 class WXDLLEXPORT wxGLContext
;
51 class WXDLLEXPORT wxGLCanvas
;
53 //---------------------------------------------------------------------------
55 //---------------------------------------------------------------------------
58 class WXDLLEXPORT wxGLContext
: public wxObject
61 wxGLContext( bool isRGB
, wxWindow
*win
, const wxPalette
& palette
= wxNullPalette
);
63 bool WXUNUSED(isRGB
), wxWindow
*win
,
64 const wxPalette
& WXUNUSED(palette
),
65 const wxGLContext
*other
/* for sharing display lists */
70 void SetColour(const char *colour
);
73 void SetupPixelFormat();
74 void SetupPalette(const wxPalette
& palette
);
75 wxPalette
CreateDefaultPalette();
77 inline wxPalette
* GetPalette() const { return (wxPalette
*) & m_palette
; }
78 inline wxWindow
* GetWindow() const { return m_window
; }
79 inline GtkWidget
* GetWidget() const { return m_widget
; }
80 inline GLXContext
GetContext() const { return m_glContext
; }
83 GLXContext m_glContext
;
90 DECLARE_CLASS(wxGLContext
)
93 //---------------------------------------------------------------------------
95 //---------------------------------------------------------------------------
97 class WXDLLEXPORT wxGLCanvas
: public wxScrolledWindow
100 inline wxGLCanvas() {
101 m_glContext
= (wxGLContext
*) NULL
;
102 m_sharedContext
= (wxGLContext
*) NULL
;
103 m_glWidget
= (GtkWidget
*) NULL
;
107 wxGLCanvas( wxWindow
*parent
, wxWindowID id
= -1,
108 const wxPoint
& pos
= wxDefaultPosition
,
109 const wxSize
& size
= wxDefaultSize
,
110 long style
= 0, const wxString
& name
= "GLCanvas",
111 int *attribList
= (int*) NULL
,
112 const wxPalette
& palette
= wxNullPalette
);
113 wxGLCanvas( wxWindow
*parent
, const wxGLContext
*shared
= (wxGLContext
*)NULL
,
115 const wxPoint
& pos
= wxDefaultPosition
,
116 const wxSize
& size
= wxDefaultSize
,
117 long style
= 0, const wxString
& name
= "GLCanvas",
118 int *attribList
= (int*) NULL
,
119 const wxPalette
& palette
= wxNullPalette
);
120 wxGLCanvas( wxWindow
*parent
, const wxGLCanvas
*shared
= (wxGLCanvas
*)NULL
,
122 const wxPoint
& pos
= wxDefaultPosition
,
123 const wxSize
& size
= wxDefaultSize
,
124 long style
= 0, const wxString
& name
= "GLCanvas",
125 int *attribList
= (int*) NULL
,
126 const wxPalette
& palette
= wxNullPalette
);
128 bool Create( wxWindow
*parent
,
129 const wxGLContext
*shared
= (wxGLContext
*)NULL
,
130 const wxGLCanvas
*shared_context_of
= (wxGLCanvas
*)NULL
,
132 const wxPoint
& pos
= wxDefaultPosition
,
133 const wxSize
& size
= wxDefaultSize
,
134 long style
= 0, const wxString
& name
= "GLCanvas",
135 int *attribList
= (int*) NULL
,
136 const wxPalette
& palette
= wxNullPalette
);
141 void SetColour(const char *colour
);
144 void OnSize(wxSizeEvent
& event
);
146 void OnInternalIdle();
148 inline wxGLContext
* GetContext() const { return m_glContext
; }
152 wxGLContext
*m_glContext
,
154 wxGLCanvas
*m_sharedContextOf
;
156 GtkWidget
*m_glWidget
;
160 DECLARE_EVENT_TABLE()
161 DECLARE_CLASS(wxGLCanvas
)