]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/glcanvas.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGLCanvas, for using OpenGL with wxWindows 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 /////////////////////////////////////////////////////////////////////////////
14 #pragma interface "glcanvas.h"
17 #ifndef _WX_GLCANVAS_H_
18 #define _WX_GLCANVAS_H_
24 #include <wx/gdicmn.h>
25 #include <wx/palette.h>
26 #include <wx/scrolwin.h>
32 WX_GL_RGBA
=1, /* use true color palette */
33 WX_GL_BUFFER_SIZE
, /* bits for buffer if not WX_GL_RGBA */
34 WX_GL_LEVEL
, /* 0 for main buffer, >0 for overlay, <0 for underlay */
35 WX_GL_DOUBLEBUFFER
, /* use doublebuffer */
36 WX_GL_STEREO
, /* use stereoscopic display */
37 WX_GL_AUX_BUFFERS
, /* number of auxiliary buffers */
38 WX_GL_MIN_RED
, /* use red buffer with most bits (> MIN_RED bits) */
39 WX_GL_MIN_GREEN
, /* use green buffer with most bits (> MIN_GREEN bits) */
40 WX_GL_MIN_BLUE
, /* use blue buffer with most bits (> MIN_BLUE bits) */
41 WX_GL_MIN_ALPHA
, /* use blue buffer with most bits (> MIN_ALPHA bits) */
42 WX_GL_DEPTH_SIZE
, /* bits for Z-buffer (0,16,32) */
43 WX_GL_STENCIL_SIZE
, /* bits for stencil buffer */
44 WX_GL_MIN_ACCUM_RED
, /* use red accum buffer with most bits (> MIN_ACCUM_RED bits) */
45 WX_GL_MIN_ACCUM_GREEN
, /* use green buffer with most bits (> MIN_ACCUM_GREEN bits) */
46 WX_GL_MIN_ACCUM_BLUE
, /* use blue buffer with most bits (> MIN_ACCUM_BLUE bits) */
47 WX_GL_MIN_ACCUM_ALPHA
/* use blue buffer with most bits (> MIN_ACCUM_ALPHA bits) */
50 //---------------------------------------------------------------------------
52 //---------------------------------------------------------------------------
55 class WXDLLEXPORT wxGLContext
: public wxObject
58 wxGLContext( bool isRGB
, wxWindow
*win
,
59 const wxPalette
& palette
= wxNullPalette
);
60 wxGLContext( 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
;
82 // GtkWidget *m_widget;
86 DECLARE_CLASS(wxGLContext
)
90 class WXDLLEXPORT wxGLCanvas
: public wxScrolledWindow
94 m_glContext
= (wxGLContext
*) NULL
;
95 m_sharedContext
= (wxGLContext
*) NULL
;
96 // m_glWidget = (GtkWidget*) NULL;
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
);
113 wxGLCanvas( wxWindow
*parent
, const wxGLCanvas
*shared
= (wxGLCanvas
*)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
);
121 bool Create( wxWindow
*parent
,
122 const wxGLContext
*shared
= (wxGLContext
*)NULL
,
123 const wxGLCanvas
*shared_context_of
= (wxGLCanvas
*)NULL
,
125 const wxPoint
& pos
= wxDefaultPosition
,
126 const wxSize
& size
= wxDefaultSize
,
127 long style
= 0, const wxString
& name
= "GLCanvas",
128 int *attribList
= (int*) NULL
,
129 const wxPalette
& palette
= wxNullPalette
);
134 void SetColour(const char *colour
);
137 // void OnSize(wxSizeEvent& event);
139 // void OnInternalIdle();
141 inline wxGLContext
* GetContext() const { return m_glContext
; }
145 wxGLContext
*m_glContext
,
147 wxGLCanvas
*m_sharedContextOf
;
149 // GtkWidget *m_glWidget;
152 DECLARE_EVENT_TABLE()
153 DECLARE_CLASS(wxGLCanvas
)