1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/glcanvas.cpp
3 // Purpose: wxGLCanvas, for using OpenGL with wxWidgets
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #if defined(__BORLANDC__)
22 #include "wx/settings.h"
28 #include "wx/palmos/private.h"
30 // DLL options compatibility check:
32 WX_CHECK_BUILD_OPTIONS("wxGL")
34 #include "wx/glcanvas.h"
36 static const wxChar
*wxGLCanvasClassName
= wxT("wxGLCanvasClass");
37 static const wxChar
*wxGLCanvasClassNameNoRedraw
= wxT("wxGLCanvasClassNR");
39 LRESULT WXDLLEXPORT APIENTRY _EXPORT
wxWndProc(HWND hWnd
, UINT message
,
40 WPARAM wParam
, LPARAM lParam
);
43 * GLContext implementation
46 wxGLContext::wxGLContext(bool WXUNUSED(isRGB
), wxGLCanvas
*win
, const wxPalette
& WXUNUSED(palette
))
50 wxGLContext::wxGLContext(
51 bool WXUNUSED(isRGB
), wxGLCanvas
*win
,
52 const wxPalette
& WXUNUSED(palette
),
53 const wxGLContext
*other
/* for sharing display lists */
58 wxGLContext::~wxGLContext()
62 void wxGLContext::SwapBuffers()
66 void wxGLContext::SetCurrent()
70 void wxGLContext::SetColour(const wxString
& colour
)
76 * wxGLCanvas implementation
79 IMPLEMENT_CLASS(wxGLCanvas
, wxWindow
)
81 BEGIN_EVENT_TABLE(wxGLCanvas
, wxWindow
)
82 EVT_SIZE(wxGLCanvas::OnSize
)
83 EVT_PALETTE_CHANGED(wxGLCanvas::OnPaletteChanged
)
84 EVT_QUERY_NEW_PALETTE(wxGLCanvas::OnQueryNewPalette
)
87 wxGLCanvas::wxGLCanvas(wxWindow
*parent
, wxWindowID id
,
88 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
,
89 int *attribList
, const wxPalette
& palette
) : wxWindow()
93 wxGLCanvas::wxGLCanvas( wxWindow
*parent
,
94 const wxGLContext
*shared
, wxWindowID id
,
95 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
,
96 int *attribList
, const wxPalette
& palette
)
101 // Not very useful for wxMSW, but this is to be wxGTK compliant
103 wxGLCanvas::wxGLCanvas( wxWindow
*parent
, const wxGLCanvas
*shared
, wxWindowID id
,
104 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
,
105 int *attribList
, const wxPalette
& palette
):
110 wxGLCanvas::~wxGLCanvas()
114 // Replaces wxWindow::Create functionality, since we need to use a different
116 bool wxGLCanvas::Create(wxWindow
*parent
,
121 const wxString
& name
)
126 static void AdjustPFDForAttributes(PIXELFORMATDESCRIPTOR
& pfd
, int *attribList
)
130 void wxGLCanvas::SetupPixelFormat(int *attribList
) // (HDC hDC)
134 void wxGLCanvas::SetupPalette(const wxPalette
& palette
)
138 void wxGLCanvas::SwapBuffers()
142 void wxGLCanvas::OnSize(wxSizeEvent
& WXUNUSED(event
))
146 void wxGLCanvas::SetCurrent()
150 void wxGLCanvas::SetColour(const wxChar
*colour
)
154 void wxGLCanvas::OnQueryNewPalette(wxQueryNewPaletteEvent
& event
)
158 void wxGLCanvas::OnPaletteChanged(wxPaletteChangedEvent
& event
)
162 void glArrayElementEXT(GLint
WXUNUSED(i
))
166 void glColorPointerEXT(GLint
WXUNUSED(size
), GLenum
WXUNUSED(type
), GLsizei
WXUNUSED(stride
), GLsizei
WXUNUSED(count
), const GLvoid
*WXUNUSED(pointer
))
170 void glDrawArraysEXT(GLenum mode
, GLint first
, GLsizei count
)
174 void glEdgeFlagPointerEXT(GLsizei
WXUNUSED(stride
), GLsizei
WXUNUSED(count
), const GLboolean
*WXUNUSED(pointer
))
178 void glGetPointervEXT(GLenum
WXUNUSED(pname
), GLvoid
* *WXUNUSED(params
))
182 void glIndexPointerEXT(GLenum
WXUNUSED(type
), GLsizei
WXUNUSED(stride
), GLsizei
WXUNUSED(count
), const GLvoid
*WXUNUSED(pointer
))
186 void glNormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
)
190 void glTexCoordPointerEXT(GLint
WXUNUSED(size
), GLenum
WXUNUSED(type
), GLsizei
WXUNUSED(stride
), GLsizei
WXUNUSED(count
), const GLvoid
*WXUNUSED(pointer
))
194 void glVertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
)
198 void glColorSubtableEXT(GLenum
WXUNUSED(target
), GLsizei
WXUNUSED(start
), GLsizei
WXUNUSED(count
), GLenum
WXUNUSED(format
), GLenum
WXUNUSED(type
), const GLvoid
*WXUNUSED(table
))
202 void glColorTableEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(internalformat
), GLsizei
WXUNUSED(width
), GLenum
WXUNUSED(format
), GLenum
WXUNUSED(type
), const GLvoid
*WXUNUSED(table
))
206 void glCopyColorTableEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(internalformat
), GLint
WXUNUSED(x
), GLint
WXUNUSED(y
), GLsizei
WXUNUSED(width
))
210 void glGetColorTableEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(format
), GLenum
WXUNUSED(type
), GLvoid
*WXUNUSED(table
))
214 void glGetColorTableParamaterfvEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(pname
), GLfloat
*WXUNUSED(params
))
218 void glGetColorTavleParameterivEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(pname
), GLint
*WXUNUSED(params
))
222 void glLockArraysSGI(GLint
WXUNUSED(first
), GLsizei
WXUNUSED(count
))
226 void glUnlockArraysSGI()
231 void glCullParameterdvSGI(GLenum
WXUNUSED(pname
), GLdouble
* WXUNUSED(params
))
235 void glCullParameterfvSGI(GLenum
WXUNUSED(pname
), GLfloat
* WXUNUSED(params
))
239 void glIndexFuncSGI(GLenum
WXUNUSED(func
), GLclampf
WXUNUSED(ref
))
243 void glIndexMaterialSGI(GLenum
WXUNUSED(face
), GLenum
WXUNUSED(mode
))
247 void glAddSwapHintRectWin(GLint
WXUNUSED(x
), GLint
WXUNUSED(y
), GLsizei
WXUNUSED(width
), GLsizei
WXUNUSED(height
))
252 //---------------------------------------------------------------------------
254 //---------------------------------------------------------------------------
256 IMPLEMENT_CLASS(wxGLApp
, wxApp
)
258 bool wxGLApp::InitGLVisual(int *attribList
)