]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/glcanvas.h
31301489e0a0816892c3f1dbc9bcb504bc7aac92
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/glcanvas.h
3 // Purpose: wxGLCanvas, for using OpenGL with wxWindows under Windows
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma interface "glcanvas.h"
16 #ifndef _WX_GLCANVAS_H_
17 #define _WX_GLCANVAS_H_
19 #include <wx/palette.h>
20 #include <wx/scrolwin.h>
26 //---------------------------------------------------------------------------
27 // Constants for attriblist
28 //---------------------------------------------------------------------------
30 // The generic GL implementation doesn't support most of these options,
31 // such as stereo, auxiliary buffers, alpha channel, and accum buffer.
32 // Other implementations may actually support them.
36 WX_GL_RGBA
=1, /* use true color palette */
37 WX_GL_BUFFER_SIZE
, /* bits for buffer if not WX_GL_RGBA */
38 WX_GL_LEVEL
, /* 0 for main buffer, >0 for overlay, <0 for underlay */
39 WX_GL_DOUBLEBUFFER
, /* use doublebuffer */
40 WX_GL_STEREO
, /* use stereoscopic display */
41 WX_GL_AUX_BUFFERS
, /* number of auxiliary buffers */
42 WX_GL_MIN_RED
, /* use red buffer with most bits (> MIN_RED bits) */
43 WX_GL_MIN_GREEN
, /* use green buffer with most bits (> MIN_GREEN bits) */
44 WX_GL_MIN_BLUE
, /* use blue buffer with most bits (> MIN_BLUE bits) */
45 WX_GL_MIN_ALPHA
, /* use blue buffer with most bits (> MIN_ALPHA bits) */
46 WX_GL_DEPTH_SIZE
, /* bits for Z-buffer (0,16,32) */
47 WX_GL_STENCIL_SIZE
, /* bits for stencil buffer */
48 WX_GL_MIN_ACCUM_RED
, /* use red accum buffer with most bits (> MIN_ACCUM_RED bits) */
49 WX_GL_MIN_ACCUM_GREEN
, /* use green buffer with most bits (> MIN_ACCUM_GREEN bits) */
50 WX_GL_MIN_ACCUM_BLUE
, /* use blue buffer with most bits (> MIN_ACCUM_BLUE bits) */
51 WX_GL_MIN_ACCUM_ALPHA
/* use blue buffer with most bits (> MIN_ACCUM_ALPHA bits) */
54 class WXDLLEXPORT wxGLCanvas
; /* forward reference */
56 class WXDLLEXPORT wxGLContext
: public wxObject
59 wxGLContext(bool isRGB
, wxGLCanvas
*win
, const wxPalette
& palette
= wxNullPalette
);
61 bool isRGB
, wxGLCanvas
*win
,
62 const wxPalette
& WXUNUSED(palette
),
63 const wxGLContext
*other
/* for sharing display lists */
68 void SetColour(const char *colour
);
72 inline wxWindow
* GetWindow() const { return m_window
; }
73 inline WXHDC
GetHDC() const { return m_hDC
; }
74 inline HGLRC
GetGLRC() const { return m_glContext
; }
82 class WXDLLEXPORT wxGLCanvas
: public wxWindow
84 DECLARE_CLASS(wxGLCanvas
)
86 wxGLCanvas(wxWindow
*parent
, wxWindowID id
= -1, const wxPoint
& pos
= wxDefaultPosition
,
87 const wxSize
& size
= wxDefaultSize
, long style
= 0,
88 const wxString
& name
= "GLCanvas", int *attribList
= 0, const wxPalette
& palette
= wxNullPalette
);
89 wxGLCanvas( wxWindow
*parent
, const wxGLContext
*shared
= (wxGLContext
*)NULL
,
90 wxWindowID id
= -1, const wxPoint
& pos
= wxDefaultPosition
,
91 const wxSize
& size
= wxDefaultSize
, long style
= 0, const wxString
& name
= "GLCanvas",
92 int *attribList
= (int*) NULL
, const wxPalette
& palette
= wxNullPalette
);
94 wxGLCanvas( wxWindow
*parent
, const wxGLCanvas
*shared
= (wxGLCanvas
*)NULL
, wxWindowID id
= -1,
95 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
, long style
= 0,
96 const wxString
& name
= "GLCanvas", int *attribList
= 0, const wxPalette
& palette
= wxNullPalette
);
100 // Replaces wxWindow::Create functionality, since we need to use a different window class
101 bool Create(wxWindow
*parent
, wxWindowID id
,
102 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
);
105 void SetColour(const char *colour
);
108 void OnSize(wxSizeEvent
& event
);
110 void OnQueryNewPalette(wxQueryNewPaletteEvent
& event
);
111 void OnPaletteChanged(wxPaletteChangedEvent
& event
);
113 inline wxGLContext
* GetContext() const { return m_glContext
; }
115 inline WXHDC
GetHDC() const { return m_hDC
; }
116 void SetupPixelFormat(int *attribList
= (int*) NULL
);
117 void SetupPalette(const wxPalette
& palette
);
118 wxPalette
CreateDefaultPalette();
120 inline wxPalette
* GetPalette() const { return (wxPalette
*) & m_palette
; }
123 wxGLContext
* m_glContext
; // this is typedef-ed ptr, in fact
127 DECLARE_EVENT_TABLE()