]>
git.saurik.com Git - wxWidgets.git/blob - utils/glcanvas/gtk/glcanvas.h
837d92f3c530928d5c6515e9417922c86ff9a894
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
57 DECLARE_CLASS(wxGLContext
)
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
; }
84 GLXContext m_glContext
;
91 //---------------------------------------------------------------------------
93 //---------------------------------------------------------------------------
95 class wxGLCanvas
: public wxScrolledWindow
97 DECLARE_CLASS(wxGLCanvas
)
100 wxGLCanvas( wxWindow
*parent
, wxWindowID id
= -1,
101 const wxPoint
& pos
= wxDefaultPosition
,
102 const wxSize
& size
= wxDefaultSize
,
103 long style
= 0, const wxString
& name
= "GLCanvas",
104 int *attribList
= (int*) NULL
,
105 const wxPalette
& palette
= wxNullPalette
);
106 wxGLCanvas( wxWindow
*parent
, const wxGLContext
*shared
= (wxGLContext
*)NULL
,
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
);
114 bool Create( wxWindow
*parent
, const wxGLContext
*shared
= (wxGLContext
*)NULL
,
116 const wxPoint
& pos
= wxDefaultPosition
,
117 const wxSize
& size
= wxDefaultSize
,
118 long style
= 0, const wxString
& name
= "GLCanvas",
119 int *attribList
= (int*) NULL
,
120 const wxPalette
& palette
= wxNullPalette
);
125 void SetColour(const char *colour
);
128 void OnSize(wxSizeEvent
& event
);
130 inline wxGLContext
* GetContext() const { return m_glContext
; }
134 virtual void DoSetSize( int x
, int y
, int width
, int height
,
135 int sizeFlags
= wxSIZE_AUTO
);
137 virtual GtkWidget
*GetConnectWidget();
138 bool IsOwnGtkWindow( GdkWindow
*window
);
140 wxGLContext
*m_glContext
;
141 GtkWidget
*m_glWidget
;
143 DECLARE_EVENT_TABLE()