]>
git.saurik.com Git - wxWidgets.git/blob - utils/glcanvas/gtk/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_
20 #include "wx/scrolwin.h"
28 //---------------------------------------------------------------------------
29 // Constants for attriblist
30 //---------------------------------------------------------------------------
34 WX_GL_RGBA
=1, /* use true color palette */
35 WX_GL_DEPTH_SIZE
, /* bits for Z-buffer (0,16,32) */
36 WX_GL_DOUBLEBUFFER
, /* use doublebuffer */
37 WX_GL_MIN_RED
, /* use red buffer with most bits (> MIN_RED bits) */
38 WX_GL_MIN_GREEN
, /* use green buffer with most bits (> MIN_GREEN bits) */
39 WX_GL_MIN_BLUE
/* use blue buffer with most bits (> MIN_BLUE bits) */
40 /* these are enough constants for now, the remaining will be added later */
43 //---------------------------------------------------------------------------
45 //---------------------------------------------------------------------------
50 //---------------------------------------------------------------------------
52 //---------------------------------------------------------------------------
55 class wxGLContext
: public wxObject
58 wxGLContext( bool isRGB
, wxWindow
*win
, const wxPalette
& palette
= wxNullPalette
);
60 bool WXUNUSED(isRGB
), wxWindow
*win
,
61 const wxPalette
& WXUNUSED(palette
),
62 const wxGLContext
*other
/* for sharing display lists */
67 void SetColour(const char *colour
);
70 void SetupPixelFormat();
71 void SetupPalette(const wxPalette
& palette
);
72 wxPalette
CreateDefaultPalette();
74 inline wxPalette
* GetPalette() const { return (wxPalette
*) & m_palette
; }
75 inline wxWindow
* GetWindow() const { return m_window
; }
76 inline GtkWidget
* GetWidget() const { return m_widget
; }
77 inline GLXContext
GetContext() const { return m_glContext
; }
80 GLXContext m_glContext
;
87 DECLARE_CLASS(wxGLContext
)
90 //---------------------------------------------------------------------------
92 //---------------------------------------------------------------------------
94 class wxGLCanvas
: public wxScrolledWindow
97 wxGLCanvas( wxWindow
*parent
, wxWindowID id
= -1,
98 const wxPoint
& pos
= wxDefaultPosition
,
99 const wxSize
& size
= wxDefaultSize
,
100 long style
= 0, const wxString
& name
= "GLCanvas",
101 int *attribList
= (int*) NULL
,
102 const wxPalette
& palette
= wxNullPalette
);
103 wxGLCanvas( wxWindow
*parent
, const wxGLContext
*shared
= (wxGLContext
*)NULL
,
105 const wxPoint
& pos
= wxDefaultPosition
,
106 const wxSize
& size
= wxDefaultSize
,
107 long style
= 0, const wxString
& name
= "GLCanvas",
108 int *attribList
= (int*) NULL
,
109 const wxPalette
& palette
= wxNullPalette
);
111 bool Create( wxWindow
*parent
, const wxGLContext
*shared
= (wxGLContext
*)NULL
,
113 const wxPoint
& pos
= wxDefaultPosition
,
114 const wxSize
& size
= wxDefaultSize
,
115 long style
= 0, const wxString
& name
= "GLCanvas",
116 int *attribList
= (int*) NULL
,
117 const wxPalette
& palette
= wxNullPalette
);
122 void SetColour(const char *colour
);
125 void OnSize(wxSizeEvent
& event
);
127 inline wxGLContext
* GetContext() const { return m_glContext
; }
131 virtual GtkWidget
*GetConnectWidget();
132 bool IsOwnGtkWindow( GdkWindow
*window
);
134 wxGLContext
*m_glContext
;
135 GtkWidget
*m_glWidget
;
138 DECLARE_EVENT_TABLE()
139 DECLARE_CLASS(wxGLCanvas
)