]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/glcanvas.h
included missing header files - without them mingw32 compilation failed
[wxWidgets.git] / include / wx / msw / glcanvas.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: glcanvas.h
3 // Purpose: wxGLCanvas, for using OpenGL with wxWindows under Windows
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma interface "glcanvas.h"
14 #endif
15
16 #ifndef _WX_GLCANVAS_H_
17 #define _WX_GLCANVAS_H_
18
19 #include <wx/setup.h>
20
21 #if wxUSE_GLCANVAS
22
23 #include <wx/palette.h>
24 #include <wx/scrolwin.h>
25
26 #include <windows.h>
27
28 #include "gl/gl.h"
29
30 //---------------------------------------------------------------------------
31 // Constants for attriblist
32 //---------------------------------------------------------------------------
33
34 enum
35 {
36 WX_GL_RGBA=1, /* use true color palette */
37 WX_GL_DEPTH_SIZE, /* bits for Z-buffer (0,16,32) */
38 WX_GL_DOUBLEBUFFER, /* use doublebuffer */
39 WX_GL_MIN_RED, /* use red buffer with most bits (> MIN_RED bits) */
40 WX_GL_MIN_GREEN, /* use green buffer with most bits (> MIN_GREEN bits) */
41 WX_GL_MIN_BLUE /* use blue buffer with most bits (> MIN_BLUE bits) */
42 /* these are enough constants for now, the remaining will be added later */
43 };
44
45 class WXDLLEXPORT wxGLCanvas; /* forward reference */
46
47 class WXDLLEXPORT wxGLContext: public wxObject
48 {
49 public:
50 wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette = wxNullPalette);
51 wxGLContext(
52 bool isRGB, wxGLCanvas *win,
53 const wxPalette& WXUNUSED(palette),
54 const wxGLContext *other /* for sharing display lists */
55 );
56 ~wxGLContext();
57
58 void SetCurrent();
59 void SetColour(const char *colour);
60 void SwapBuffers();
61
62
63 inline wxWindow* GetWindow() const { return m_window; }
64 inline WXHDC GetHDC() const { return m_hDC; }
65 inline HGLRC GetGLRC() const { return m_glContext; }
66
67 public:
68 HGLRC m_glContext;
69 WXHDC m_hDC;
70 wxWindow* m_window;
71 };
72
73 class WXDLLEXPORT wxGLCanvas: public wxScrolledWindow
74 {
75 DECLARE_CLASS(wxGLCanvas)
76 public:
77 wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
78 const wxSize& size = wxDefaultSize, long style = 0,
79 const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette);
80 wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL,
81 wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
82 const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "GLCanvas",
83 int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette );
84
85 wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1,
86 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0,
87 const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette );
88
89 ~wxGLCanvas();
90
91 // Replaces wxWindow::Create functionality, since we need to use a different window class
92 bool Create(wxWindow *parent, wxWindowID id,
93 const wxPoint& pos, const wxSize& size, long style, const wxString& name);
94
95 void SetCurrent();
96 void SetColour(const char *colour);
97 void SwapBuffers();
98
99 void OnSize(wxSizeEvent& event);
100
101 void OnQueryNewPalette(wxQueryNewPaletteEvent& event);
102 void OnPaletteChanged(wxPaletteChangedEvent& event);
103
104 inline wxGLContext* GetContext() const { return m_glContext; }
105
106 inline WXHDC GetHDC() const { return m_hDC; }
107 void SetupPixelFormat();
108 void SetupPalette(const wxPalette& palette);
109 wxPalette CreateDefaultPalette();
110
111 inline wxPalette* GetPalette() const { return (wxPalette*) & m_palette; }
112
113 protected:
114 wxGLContext* m_glContext; // this is typedef-ed ptr, in fact
115 wxPalette m_palette;
116 WXHDC m_hDC;
117
118 DECLARE_EVENT_TABLE()
119 };
120
121 #ifdef __cplusplus
122 extern "C" {
123 #endif
124
125 /* Give extensions proper function names. */
126
127 /* N.B. - this is not completely implemented as yet */
128
129 /* EXT_vertex_array */
130 void glArrayElementEXT(GLint i);
131 void glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
132 void glDrawArraysEXT(GLenum mode, GLint first, GLsizei count);
133 void glEdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *pointer);
134 void glGetPointervEXT(GLenum pname, GLvoid* *params);
135 void glIndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
136 void glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
137 void glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
138 void glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
139
140 /* EXT_color_subtable */
141 void glColorSubtableEXT(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table);
142
143 /* EXT_color_table */
144 void glColorTableEXT(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
145 void glCopyColorTableEXT(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
146 void glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid *table);
147 void glGetColorTableParamaterfvEXT(GLenum target, GLenum pname, GLfloat *params);
148 void glGetColorTavleParameterivEXT(GLenum target, GLenum pname, GLint *params);
149
150 /* SGI_compiled_vertex_array */
151 void glLockArraysSGI(GLint first, GLsizei count);
152 void glUnlockArraysSGI();
153
154 /* SGI_cull_vertex */
155 void glCullParameterdvSGI(GLenum pname, GLdouble* params);
156 void glCullParameterfvSGI(GLenum pname, GLfloat* params);
157
158 /* SGI_index_func */
159 void glIndexFuncSGI(GLenum func, GLclampf ref);
160
161 /* SGI_index_material */
162 void glIndexMaterialSGI(GLenum face, GLenum mode);
163
164 /* WIN_swap_hint */
165 void glAddSwapHintRectWin(GLint x, GLint y, GLsizei width, GLsizei height);
166
167 #ifdef __cplusplus
168 }
169 #endif
170
171 #endif
172 // wxUSE_GLCANVAS
173 #endif
174 // _WX_GLCANVAS_H_
175