]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/glcanvas.h
gtkfeatures.h does not exist under gtk+ 1.3.1, #ifndef it out
[wxWidgets.git] / include / wx / msw / glcanvas.h
CommitLineData
8b089c5e
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/setup.h>
20
21#if wxUSE_GLCANVAS
22
7e42f2f8 23#include <wx/palette.h>
8b089c5e
JS
24#include <wx/scrolwin.h>
25
26#include <windows.h>
27
28#include "gl/gl.h"
29
30//---------------------------------------------------------------------------
31// Constants for attriblist
32//---------------------------------------------------------------------------
33
34enum
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
45class WXDLLEXPORT wxGLCanvas; /* forward reference */
46
47class WXDLLEXPORT wxGLContext: public wxObject
48{
49public:
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
67public:
68 HGLRC m_glContext;
69 WXHDC m_hDC;
70 wxWindow* m_window;
71};
72
73class 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
113protected:
114 wxGLContext* m_glContext; // this is typedef-ed ptr, in fact
115 wxPalette m_palette;
116 WXHDC m_hDC;
117
118DECLARE_EVENT_TABLE()
119};
120
121#ifdef __cplusplus
122extern "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 */
130void glArrayElementEXT(GLint i);
131void glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
132void glDrawArraysEXT(GLenum mode, GLint first, GLsizei count);
133void glEdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *pointer);
134void glGetPointervEXT(GLenum pname, GLvoid* *params);
135void glIndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
136void glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
137void glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
138void glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
139
140/* EXT_color_subtable */
141void glColorSubtableEXT(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table);
142
143/* EXT_color_table */
144void glColorTableEXT(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
145void glCopyColorTableEXT(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
146void glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid *table);
147void glGetColorTableParamaterfvEXT(GLenum target, GLenum pname, GLfloat *params);
148void glGetColorTavleParameterivEXT(GLenum target, GLenum pname, GLint *params);
149
150/* SGI_compiled_vertex_array */
151void glLockArraysSGI(GLint first, GLsizei count);
152void glUnlockArraysSGI();
153
154/* SGI_cull_vertex */
155void glCullParameterdvSGI(GLenum pname, GLdouble* params);
156void glCullParameterfvSGI(GLenum pname, GLfloat* params);
157
158/* SGI_index_func */
159void glIndexFuncSGI(GLenum func, GLclampf ref);
160
161/* SGI_index_material */
162void glIndexMaterialSGI(GLenum face, GLenum mode);
163
164/* WIN_swap_hint */
165void 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