]> git.saurik.com Git - wxWidgets.git/blob - utils/glcanvas/win/glcanvas.h
wxCheckListBox fixes: crash/memory leak when items are dynamically
[wxWidgets.git] / utils / glcanvas / win / 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/scrolwin.h>
20
21 #include <windows.h>
22
23 #include "gl/gl.h"
24
25 class wxGLContext: public wxObject
26 {
27 public:
28 wxGLContext(bool isRGB, wxWindow *win, const wxPalette& palette = wxNullPalette);
29 ~wxGLContext();
30
31 void SetCurrent();
32 void SetColour(const char *colour);
33 void SwapBuffers();
34
35 void SetupPixelFormat();
36 void SetupPalette(const wxPalette& palette);
37 wxPalette CreateDefaultPalette();
38
39 inline wxPalette* GetPalette() const { return (wxPalette*) & m_palette; }
40 inline wxWindow* GetWindow() const { return m_window; }
41 inline WXHDC GetHDC() const { return m_hDC; }
42 inline HGLRC GetGLRC() const { return m_glContext; }
43
44 public:
45 HGLRC m_glContext;
46 WXHDC m_hDC;
47 wxPalette m_palette;
48 wxWindow* m_window;
49 };
50
51 class wxGLCanvas: public wxScrolledWindow
52 {
53 DECLARE_CLASS(wxGLCanvas)
54 public:
55 wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
56 const wxSize& size = wxDefaultSize, long style = 0,
57 const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette);
58 ~wxGLCanvas();
59
60 void SetCurrent();
61 void SetColour(const char *colour);
62 void SwapBuffers();
63
64 void OnSize(wxSizeEvent& event);
65
66 void OnQueryNewPalette(wxQueryNewPaletteEvent& event);
67 void OnPaletteChanged(wxPaletteChangedEvent& event);
68
69 inline wxGLContext* GetContext() const { return m_glContext; }
70
71 protected:
72 wxGLContext* m_glContext; // this is typedef-ed ptr, in fact
73
74 DECLARE_EVENT_TABLE()
75 };
76
77 #ifdef __cplusplus
78 extern "C" {
79 #endif
80
81 /* Give extensions proper function names. */
82
83 /* N.B. - this is not completely implemented as yet */
84
85 /* EXT_vertex_array */
86 void glArrayElementEXT(GLint i);
87 void glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
88 void glDrawArraysEXT(GLenum mode, GLint first, GLsizei count);
89 void glEdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *pointer);
90 void glGetPointervEXT(GLenum pname, GLvoid* *params);
91 void glIndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
92 void glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
93 void glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
94 void glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
95
96 /* EXT_color_subtable */
97 void glColorSubtableEXT(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table);
98
99 /* EXT_color_table */
100 void glColorTableEXT(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
101 void glCopyColorTableEXT(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
102 void glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid *table);
103 void glGetColorTableParamaterfvEXT(GLenum target, GLenum pname, GLfloat *params);
104 void glGetColorTavleParameterivEXT(GLenum target, GLenum pname, GLint *params);
105
106 /* SGI_compiled_vertex_array */
107 void glLockArraysSGI(GLint first, GLsizei count);
108 void glUnlockArraysSGI();
109
110 /* SGI_cull_vertex */
111 void glCullParameterdvSGI(GLenum pname, GLdouble* params);
112 void glCullParameterfvSGI(GLenum pname, GLfloat* params);
113
114 /* SGI_index_func */
115 void glIndexFuncSGI(GLenum func, GLclampf ref);
116
117 /* SGI_index_material */
118 void glIndexMaterialSGI(GLenum face, GLenum mode);
119
120 /* WIN_swap_hint */
121 void glAddSwapHintRectWin(GLint x, GLint y, GLsizei width, GLsizei height);
122
123 #ifdef __cplusplus
124 }
125 #endif
126
127 #endif