]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/glcanvas.h
f743c5430a83edbf1160e7d54e8610c743973a08
1 /////////////////////////////////////////////////////////////////////////////
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_
23 #include <wx/scrolwin.h>
29 //---------------------------------------------------------------------------
30 // Constants for attriblist
31 //---------------------------------------------------------------------------
35 WX_GL_RGBA
=1, /* use true color palette */
36 WX_GL_DEPTH_SIZE
, /* bits for Z-buffer (0,16,32) */
37 WX_GL_DOUBLEBUFFER
, /* use doublebuffer */
38 WX_GL_MIN_RED
, /* use red buffer with most bits (> MIN_RED bits) */
39 WX_GL_MIN_GREEN
, /* use green buffer with most bits (> MIN_GREEN bits) */
40 WX_GL_MIN_BLUE
/* use blue buffer with most bits (> MIN_BLUE bits) */
41 /* these are enough constants for now, the remaining will be added later */
44 class WXDLLEXPORT wxGLCanvas
; /* forward reference */
46 class WXDLLEXPORT wxGLContext
: public wxObject
49 wxGLContext(bool isRGB
, wxGLCanvas
*win
, const wxPalette
& palette
= wxNullPalette
);
51 bool isRGB
, wxGLCanvas
*win
,
52 const wxPalette
& WXUNUSED(palette
),
53 const wxGLContext
*other
/* for sharing display lists */
58 void SetColour(const char *colour
);
62 inline wxWindow
* GetWindow() const { return m_window
; }
63 inline WXHDC
GetHDC() const { return m_hDC
; }
64 inline HGLRC
GetGLRC() const { return m_glContext
; }
72 class WXDLLEXPORT wxGLCanvas
: public wxScrolledWindow
74 DECLARE_CLASS(wxGLCanvas
)
76 wxGLCanvas(wxWindow
*parent
, wxWindowID id
= -1, const wxPoint
& pos
= wxDefaultPosition
,
77 const wxSize
& size
= wxDefaultSize
, long style
= 0,
78 const wxString
& name
= "GLCanvas", int *attribList
= 0, const wxPalette
& palette
= wxNullPalette
);
79 wxGLCanvas( wxWindow
*parent
, const wxGLContext
*shared
= (wxGLContext
*)NULL
,
80 wxWindowID id
= -1, const wxPoint
& pos
= wxDefaultPosition
,
81 const wxSize
& size
= wxDefaultSize
, long style
= 0, const wxString
& name
= "GLCanvas",
82 int *attribList
= (int*) NULL
, const wxPalette
& palette
= wxNullPalette
);
84 wxGLCanvas( wxWindow
*parent
, const wxGLCanvas
*shared
= (wxGLCanvas
*)NULL
, wxWindowID id
= -1,
85 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
, long style
= 0,
86 const wxString
& name
= "GLCanvas", int *attribList
= 0, const wxPalette
& palette
= wxNullPalette
);
90 // Replaces wxWindow::Create functionality, since we need to use a different window class
91 bool Create(wxWindow
*parent
, wxWindowID id
,
92 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
);
95 void SetColour(const char *colour
);
98 void OnSize(wxSizeEvent
& event
);
100 void OnQueryNewPalette(wxQueryNewPaletteEvent
& event
);
101 void OnPaletteChanged(wxPaletteChangedEvent
& event
);
103 inline wxGLContext
* GetContext() const { return m_glContext
; }
105 inline WXHDC
GetHDC() const { return m_hDC
; }
106 void SetupPixelFormat();
107 void SetupPalette(const wxPalette
& palette
);
108 wxPalette
CreateDefaultPalette();
110 inline wxPalette
* GetPalette() const { return (wxPalette
*) & m_palette
; }
113 wxGLContext
* m_glContext
; // this is typedef-ed ptr, in fact
117 DECLARE_EVENT_TABLE()
124 /* Give extensions proper function names. */
126 /* N.B. - this is not completely implemented as yet */
128 /* EXT_vertex_array */
129 void glArrayElementEXT(GLint i
);
130 void glColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
);
131 void glDrawArraysEXT(GLenum mode
, GLint first
, GLsizei count
);
132 void glEdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*pointer
);
133 void glGetPointervEXT(GLenum pname
, GLvoid
* *params
);
134 void glIndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
);
135 void glNormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
);
136 void glTexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
);
137 void glVertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
);
139 /* EXT_color_subtable */
140 void glColorSubtableEXT(GLenum target
, GLsizei start
, GLsizei count
, GLenum format
, GLenum type
, const GLvoid
*table
);
142 /* EXT_color_table */
143 void glColorTableEXT(GLenum target
, GLenum internalformat
, GLsizei width
, GLenum format
, GLenum type
, const GLvoid
*table
);
144 void glCopyColorTableEXT(GLenum target
, GLenum internalformat
, GLint x
, GLint y
, GLsizei width
);
145 void glGetColorTableEXT(GLenum target
, GLenum format
, GLenum type
, GLvoid
*table
);
146 void glGetColorTableParamaterfvEXT(GLenum target
, GLenum pname
, GLfloat
*params
);
147 void glGetColorTavleParameterivEXT(GLenum target
, GLenum pname
, GLint
*params
);
149 /* SGI_compiled_vertex_array */
150 void glLockArraysSGI(GLint first
, GLsizei count
);
151 void glUnlockArraysSGI();
153 /* SGI_cull_vertex */
154 void glCullParameterdvSGI(GLenum pname
, GLdouble
* params
);
155 void glCullParameterfvSGI(GLenum pname
, GLfloat
* params
);
158 void glIndexFuncSGI(GLenum func
, GLclampf ref
);
160 /* SGI_index_material */
161 void glIndexMaterialSGI(GLenum face
, GLenum mode
);
164 void glAddSwapHintRectWin(GLint x
, GLint y
, GLsizei width
, GLsizei height
);