]>
git.saurik.com Git - wxWidgets.git/blob - utils/glcanvas/win/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_
19 #include <wx/scrolwin.h>
25 //---------------------------------------------------------------------------
26 // Constants for attriblist
27 //---------------------------------------------------------------------------
31 WX_GL_RGBA
=1, /* use true color palette */
32 WX_GL_DEPTH_SIZE
, /* bits for Z-buffer (0,16,32) */
33 WX_GL_DOUBLEBUFFER
, /* use doublebuffer */
34 WX_GL_MIN_RED
, /* use red buffer with most bits (> MIN_RED bits) */
35 WX_GL_MIN_GREEN
, /* use green buffer with most bits (> MIN_GREEN bits) */
36 WX_GL_MIN_BLUE
/* use blue buffer with most bits (> MIN_BLUE bits) */
37 /* these are enough constants for now, the remaining will be added later */
40 class wxGLCanvas
; /* forward reference */
42 class wxGLContext
: public wxObject
45 wxGLContext(bool isRGB
, wxGLCanvas
*win
, const wxPalette
& palette
= wxNullPalette
);
47 bool isRGB
, wxGLCanvas
*win
,
48 const wxPalette
& WXUNUSED(palette
),
49 const wxGLContext
*other
/* for sharing display lists */
54 void SetColour(const char *colour
);
58 inline wxWindow
* GetWindow() const { return m_window
; }
59 inline WXHDC
GetHDC() const { return m_hDC
; }
60 inline HGLRC
GetGLRC() const { return m_glContext
; }
68 class wxGLCanvas
: public wxScrolledWindow
70 DECLARE_CLASS(wxGLCanvas
)
74 m_glContext
= (wxGLContext
*) NULL
;
78 wxGLCanvas(wxWindow
*parent
, wxWindowID id
= -1, const wxPoint
& pos
= wxDefaultPosition
,
79 const wxSize
& size
= wxDefaultSize
, long style
= 0,
80 const wxString
& name
= "GLCanvas", int *attribList
= 0, const wxPalette
& palette
= wxNullPalette
);
81 wxGLCanvas( wxWindow
*parent
, const wxGLContext
*shared
= (wxGLContext
*)NULL
,
82 wxWindowID id
= -1, const wxPoint
& pos
= wxDefaultPosition
,
83 const wxSize
& size
= wxDefaultSize
, long style
= 0, const wxString
& name
= "GLCanvas",
84 int *attribList
= (int*) NULL
, const wxPalette
& palette
= wxNullPalette
);
88 // Replaces wxWindow::Create functionality, since we need to use a different window class
89 bool Create(wxWindow
*parent
, wxWindowID id
,
90 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
);
93 void SetColour(const char *colour
);
96 void OnSize(wxSizeEvent
& event
);
98 void OnQueryNewPalette(wxQueryNewPaletteEvent
& event
);
99 void OnPaletteChanged(wxPaletteChangedEvent
& event
);
101 inline wxGLContext
* GetContext() const { return m_glContext
; }
104 inline WXHDC
GetHDC() const { return m_hDC
; }
105 void SetupPixelFormat();
106 void SetupPalette(const wxPalette
& palette
);
107 wxPalette
CreateDefaultPalette();
109 inline wxPalette
* GetPalette() const { return (wxPalette
*) & m_palette
; }
112 wxGLContext
* m_glContext
; // this is typedef-ed ptr, in fact
116 DECLARE_EVENT_TABLE()
123 /* Give extensions proper function names. */
125 /* N.B. - this is not completely implemented as yet */
127 /* EXT_vertex_array */
128 void glArrayElementEXT(GLint i
);
129 void glColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
);
130 void glDrawArraysEXT(GLenum mode
, GLint first
, GLsizei count
);
131 void glEdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*pointer
);
132 void glGetPointervEXT(GLenum pname
, GLvoid
* *params
);
133 void glIndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
);
134 void glNormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
);
135 void glTexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
);
136 void glVertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
);
138 /* EXT_color_subtable */
139 void glColorSubtableEXT(GLenum target
, GLsizei start
, GLsizei count
, GLenum format
, GLenum type
, const GLvoid
*table
);
141 /* EXT_color_table */
142 void glColorTableEXT(GLenum target
, GLenum internalformat
, GLsizei width
, GLenum format
, GLenum type
, const GLvoid
*table
);
143 void glCopyColorTableEXT(GLenum target
, GLenum internalformat
, GLint x
, GLint y
, GLsizei width
);
144 void glGetColorTableEXT(GLenum target
, GLenum format
, GLenum type
, GLvoid
*table
);
145 void glGetColorTableParamaterfvEXT(GLenum target
, GLenum pname
, GLfloat
*params
);
146 void glGetColorTavleParameterivEXT(GLenum target
, GLenum pname
, GLint
*params
);
148 /* SGI_compiled_vertex_array */
149 void glLockArraysSGI(GLint first
, GLsizei count
);
150 void glUnlockArraysSGI();
152 /* SGI_cull_vertex */
153 void glCullParameterdvSGI(GLenum pname
, GLdouble
* params
);
154 void glCullParameterfvSGI(GLenum pname
, GLfloat
* params
);
157 void glIndexFuncSGI(GLenum func
, GLclampf ref
);
159 /* SGI_index_material */
160 void glIndexMaterialSGI(GLenum face
, GLenum mode
);
163 void glAddSwapHintRectWin(GLint x
, GLint y
, GLsizei width
, GLsizei height
);