]> git.saurik.com Git - wxWidgets.git/blame - utils/glcanvas/win/glcanvas.h
wxCheckListBox fixes: crash/memory leak when items are dynamically
[wxWidgets.git] / utils / glcanvas / win / glcanvas.h
CommitLineData
6a1120ad
JS
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
89c684ef
JS
21#include <windows.h>
22
6a1120ad
JS
23#include "gl/gl.h"
24
25class wxGLContext: public wxObject
26{
27public:
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
44public:
45 HGLRC m_glContext;
46 WXHDC m_hDC;
47 wxPalette m_palette;
48 wxWindow* m_window;
49};
50
51class 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
71protected:
72 wxGLContext* m_glContext; // this is typedef-ed ptr, in fact
73
74DECLARE_EVENT_TABLE()
75};
76
77#ifdef __cplusplus
78extern "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 */
86void glArrayElementEXT(GLint i);
87void glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
88void glDrawArraysEXT(GLenum mode, GLint first, GLsizei count);
89void glEdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *pointer);
90void glGetPointervEXT(GLenum pname, GLvoid* *params);
91void glIndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
92void glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
93void glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
94void glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
95
96/* EXT_color_subtable */
97void glColorSubtableEXT(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table);
98
99/* EXT_color_table */
100void glColorTableEXT(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
101void glCopyColorTableEXT(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
102void glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid *table);
103void glGetColorTableParamaterfvEXT(GLenum target, GLenum pname, GLfloat *params);
104void glGetColorTavleParameterivEXT(GLenum target, GLenum pname, GLint *params);
105
106/* SGI_compiled_vertex_array */
107void glLockArraysSGI(GLint first, GLsizei count);
108void glUnlockArraysSGI();
109
110/* SGI_cull_vertex */
111void glCullParameterdvSGI(GLenum pname, GLdouble* params);
112void glCullParameterfvSGI(GLenum pname, GLfloat* params);
113
114/* SGI_index_func */
115void glIndexFuncSGI(GLenum func, GLclampf ref);
116
117/* SGI_index_material */
118void glIndexMaterialSGI(GLenum face, GLenum mode);
119
120/* WIN_swap_hint */
121void glAddSwapHintRectWin(GLint x, GLint y, GLsizei width, GLsizei height);
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif