1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/glcanvas.cpp
3 // Purpose: wxGLCanvas, for using OpenGL with wxWidgets
4 // Author: William Osborne
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "glcanvas.h"
16 #include "wx/wxprec.h"
18 #if defined(__BORLANDC__)
26 #include "wx/settings.h"
32 #include "wx/palmos/private.h"
34 // DLL options compatibility check:
36 WX_CHECK_BUILD_OPTIONS("wxGL")
38 #include "wx/glcanvas.h"
40 static const wxChar
*wxGLCanvasClassName
= wxT("wxGLCanvasClass");
41 static const wxChar
*wxGLCanvasClassNameNoRedraw
= wxT("wxGLCanvasClassNR");
43 LRESULT WXDLLEXPORT APIENTRY _EXPORT
wxWndProc(HWND hWnd
, UINT message
,
44 WPARAM wParam
, LPARAM lParam
);
47 * GLContext implementation
50 wxGLContext::wxGLContext(bool WXUNUSED(isRGB
), wxGLCanvas
*win
, const wxPalette
& WXUNUSED(palette
))
54 wxGLContext::wxGLContext(
55 bool WXUNUSED(isRGB
), wxGLCanvas
*win
,
56 const wxPalette
& WXUNUSED(palette
),
57 const wxGLContext
*other
/* for sharing display lists */
62 wxGLContext::~wxGLContext()
66 void wxGLContext::SwapBuffers()
70 void wxGLContext::SetCurrent()
74 void wxGLContext::SetColour(const wxChar
*colour
)
80 * wxGLCanvas implementation
83 IMPLEMENT_CLASS(wxGLCanvas
, wxWindow
)
85 BEGIN_EVENT_TABLE(wxGLCanvas
, wxWindow
)
86 EVT_SIZE(wxGLCanvas::OnSize
)
87 EVT_PALETTE_CHANGED(wxGLCanvas::OnPaletteChanged
)
88 EVT_QUERY_NEW_PALETTE(wxGLCanvas::OnQueryNewPalette
)
91 wxGLCanvas::wxGLCanvas(wxWindow
*parent
, wxWindowID id
,
92 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
,
93 int *attribList
, const wxPalette
& palette
) : wxWindow()
97 wxGLCanvas::wxGLCanvas( wxWindow
*parent
,
98 const wxGLContext
*shared
, wxWindowID id
,
99 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
,
100 int *attribList
, const wxPalette
& palette
)
105 // Not very useful for wxMSW, but this is to be wxGTK compliant
107 wxGLCanvas::wxGLCanvas( wxWindow
*parent
, const wxGLCanvas
*shared
, wxWindowID id
,
108 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
,
109 int *attribList
, const wxPalette
& palette
):
114 wxGLCanvas::~wxGLCanvas()
118 // Replaces wxWindow::Create functionality, since we need to use a different
120 bool wxGLCanvas::Create(wxWindow
*parent
,
125 const wxString
& name
)
130 static void AdjustPFDForAttributes(PIXELFORMATDESCRIPTOR
& pfd
, int *attribList
)
134 void wxGLCanvas::SetupPixelFormat(int *attribList
) // (HDC hDC)
138 void wxGLCanvas::SetupPalette(const wxPalette
& palette
)
142 wxPalette
wxGLCanvas::CreateDefaultPalette()
149 void wxGLCanvas::SwapBuffers()
153 void wxGLCanvas::OnSize(wxSizeEvent
& WXUNUSED(event
))
157 void wxGLCanvas::SetCurrent()
161 void wxGLCanvas::SetColour(const wxChar
*colour
)
165 void wxGLCanvas::OnQueryNewPalette(wxQueryNewPaletteEvent
& event
)
169 void wxGLCanvas::OnPaletteChanged(wxPaletteChangedEvent
& event
)
173 void glArrayElementEXT(GLint
WXUNUSED(i
))
177 void glColorPointerEXT(GLint
WXUNUSED(size
), GLenum
WXUNUSED(type
), GLsizei
WXUNUSED(stride
), GLsizei
WXUNUSED(count
), const GLvoid
*WXUNUSED(pointer
))
181 void glDrawArraysEXT(GLenum mode
, GLint first
, GLsizei count
)
185 void glEdgeFlagPointerEXT(GLsizei
WXUNUSED(stride
), GLsizei
WXUNUSED(count
), const GLboolean
*WXUNUSED(pointer
))
189 void glGetPointervEXT(GLenum
WXUNUSED(pname
), GLvoid
* *WXUNUSED(params
))
193 void glIndexPointerEXT(GLenum
WXUNUSED(type
), GLsizei
WXUNUSED(stride
), GLsizei
WXUNUSED(count
), const GLvoid
*WXUNUSED(pointer
))
197 void glNormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
)
201 void glTexCoordPointerEXT(GLint
WXUNUSED(size
), GLenum
WXUNUSED(type
), GLsizei
WXUNUSED(stride
), GLsizei
WXUNUSED(count
), const GLvoid
*WXUNUSED(pointer
))
205 void glVertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
)
209 void glColorSubtableEXT(GLenum
WXUNUSED(target
), GLsizei
WXUNUSED(start
), GLsizei
WXUNUSED(count
), GLenum
WXUNUSED(format
), GLenum
WXUNUSED(type
), const GLvoid
*WXUNUSED(table
))
213 void glColorTableEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(internalformat
), GLsizei
WXUNUSED(width
), GLenum
WXUNUSED(format
), GLenum
WXUNUSED(type
), const GLvoid
*WXUNUSED(table
))
217 void glCopyColorTableEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(internalformat
), GLint
WXUNUSED(x
), GLint
WXUNUSED(y
), GLsizei
WXUNUSED(width
))
221 void glGetColorTableEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(format
), GLenum
WXUNUSED(type
), GLvoid
*WXUNUSED(table
))
225 void glGetColorTableParamaterfvEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(pname
), GLfloat
*WXUNUSED(params
))
229 void glGetColorTavleParameterivEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(pname
), GLint
*WXUNUSED(params
))
233 void glLockArraysSGI(GLint
WXUNUSED(first
), GLsizei
WXUNUSED(count
))
237 void glUnlockArraysSGI()
242 void glCullParameterdvSGI(GLenum
WXUNUSED(pname
), GLdouble
* WXUNUSED(params
))
246 void glCullParameterfvSGI(GLenum
WXUNUSED(pname
), GLfloat
* WXUNUSED(params
))
250 void glIndexFuncSGI(GLenum
WXUNUSED(func
), GLclampf
WXUNUSED(ref
))
254 void glIndexMaterialSGI(GLenum
WXUNUSED(face
), GLenum
WXUNUSED(mode
))
258 void glAddSwapHintRectWin(GLint
WXUNUSED(x
), GLint
WXUNUSED(y
), GLsizei
WXUNUSED(width
), GLsizei
WXUNUSED(height
))
263 //---------------------------------------------------------------------------
265 //---------------------------------------------------------------------------
267 IMPLEMENT_CLASS(wxGLApp
, wxApp
)
269 bool wxGLApp::InitGLVisual(int *attribList
)