]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/glcanvas.h
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/palette.h>
24 #include <wx/scrolwin.h>
30 //---------------------------------------------------------------------------
31 // Constants for attriblist
32 //---------------------------------------------------------------------------
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 */
45 class WXDLLEXPORT wxGLCanvas
; /* forward reference */
47 class WXDLLEXPORT wxGLContext
: public wxObject
50 wxGLContext(bool isRGB
, wxGLCanvas
*win
, const wxPalette
& palette
= wxNullPalette
);
52 bool isRGB
, wxGLCanvas
*win
,
53 const wxPalette
& WXUNUSED(palette
),
54 const wxGLContext
*other
/* for sharing display lists */
59 void SetColour(const char *colour
);
63 inline wxWindow
* GetWindow() const { return m_window
; }
64 inline WXHDC
GetHDC() const { return m_hDC
; }
65 inline HGLRC
GetGLRC() const { return m_glContext
; }
73 class WXDLLEXPORT wxGLCanvas
: public wxScrolledWindow
75 DECLARE_CLASS(wxGLCanvas
)
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
);
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
);
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
);
96 void SetColour(const char *colour
);
99 void OnSize(wxSizeEvent
& event
);
101 void OnQueryNewPalette(wxQueryNewPaletteEvent
& event
);
102 void OnPaletteChanged(wxPaletteChangedEvent
& event
);
104 inline wxGLContext
* GetContext() const { return m_glContext
; }
106 inline WXHDC
GetHDC() const { return m_hDC
; }
107 void SetupPixelFormat();
108 void SetupPalette(const wxPalette
& palette
);
109 wxPalette
CreateDefaultPalette();
111 inline wxPalette
* GetPalette() const { return (wxPalette
*) & m_palette
; }
114 wxGLContext
* m_glContext
; // this is typedef-ed ptr, in fact
118 DECLARE_EVENT_TABLE()
125 /* Give extensions proper function names. */
127 /* N.B. - this is not completely implemented as yet */
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
);
140 /* EXT_color_subtable */
141 void glColorSubtableEXT(GLenum target
, GLsizei start
, GLsizei count
, GLenum format
, GLenum type
, const GLvoid
*table
);
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
);
150 /* SGI_compiled_vertex_array */
151 void glLockArraysSGI(GLint first
, GLsizei count
);
152 void glUnlockArraysSGI();
154 /* SGI_cull_vertex */
155 void glCullParameterdvSGI(GLenum pname
, GLdouble
* params
);
156 void glCullParameterfvSGI(GLenum pname
, GLfloat
* params
);
159 void glIndexFuncSGI(GLenum func
, GLclampf ref
);
161 /* SGI_index_material */
162 void glIndexMaterialSGI(GLenum face
, GLenum mode
);
165 void glAddSwapHintRectWin(GLint x
, GLint y
, GLsizei width
, GLsizei height
);