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 wxChar
*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 wxPalette
wxGLCanvas::CreateDefaultPalette()
145 void wxGLCanvas::SwapBuffers()
149 void wxGLCanvas::OnSize(wxSizeEvent
& WXUNUSED(event
))
153 void wxGLCanvas::SetCurrent()
157 void wxGLCanvas::SetColour(const wxChar
*colour
)
161 void wxGLCanvas::OnQueryNewPalette(wxQueryNewPaletteEvent
& event
)
165 void wxGLCanvas::OnPaletteChanged(wxPaletteChangedEvent
& event
)
169 void glArrayElementEXT(GLint
WXUNUSED(i
))
173 void glColorPointerEXT(GLint
WXUNUSED(size
), GLenum
WXUNUSED(type
), GLsizei
WXUNUSED(stride
), GLsizei
WXUNUSED(count
), const GLvoid
*WXUNUSED(pointer
))
177 void glDrawArraysEXT(GLenum mode
, GLint first
, GLsizei count
)
181 void glEdgeFlagPointerEXT(GLsizei
WXUNUSED(stride
), GLsizei
WXUNUSED(count
), const GLboolean
*WXUNUSED(pointer
))
185 void glGetPointervEXT(GLenum
WXUNUSED(pname
), GLvoid
* *WXUNUSED(params
))
189 void glIndexPointerEXT(GLenum
WXUNUSED(type
), GLsizei
WXUNUSED(stride
), GLsizei
WXUNUSED(count
), const GLvoid
*WXUNUSED(pointer
))
193 void glNormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
)
197 void glTexCoordPointerEXT(GLint
WXUNUSED(size
), GLenum
WXUNUSED(type
), GLsizei
WXUNUSED(stride
), GLsizei
WXUNUSED(count
), const GLvoid
*WXUNUSED(pointer
))
201 void glVertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
, GLsizei count
, const GLvoid
*pointer
)
205 void glColorSubtableEXT(GLenum
WXUNUSED(target
), GLsizei
WXUNUSED(start
), GLsizei
WXUNUSED(count
), GLenum
WXUNUSED(format
), GLenum
WXUNUSED(type
), const GLvoid
*WXUNUSED(table
))
209 void glColorTableEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(internalformat
), GLsizei
WXUNUSED(width
), GLenum
WXUNUSED(format
), GLenum
WXUNUSED(type
), const GLvoid
*WXUNUSED(table
))
213 void glCopyColorTableEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(internalformat
), GLint
WXUNUSED(x
), GLint
WXUNUSED(y
), GLsizei
WXUNUSED(width
))
217 void glGetColorTableEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(format
), GLenum
WXUNUSED(type
), GLvoid
*WXUNUSED(table
))
221 void glGetColorTableParamaterfvEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(pname
), GLfloat
*WXUNUSED(params
))
225 void glGetColorTavleParameterivEXT(GLenum
WXUNUSED(target
), GLenum
WXUNUSED(pname
), GLint
*WXUNUSED(params
))
229 void glLockArraysSGI(GLint
WXUNUSED(first
), GLsizei
WXUNUSED(count
))
233 void glUnlockArraysSGI()
238 void glCullParameterdvSGI(GLenum
WXUNUSED(pname
), GLdouble
* WXUNUSED(params
))
242 void glCullParameterfvSGI(GLenum
WXUNUSED(pname
), GLfloat
* WXUNUSED(params
))
246 void glIndexFuncSGI(GLenum
WXUNUSED(func
), GLclampf
WXUNUSED(ref
))
250 void glIndexMaterialSGI(GLenum
WXUNUSED(face
), GLenum
WXUNUSED(mode
))
254 void glAddSwapHintRectWin(GLint
WXUNUSED(x
), GLint
WXUNUSED(y
), GLsizei
WXUNUSED(width
), GLsizei
WXUNUSED(height
))
259 //---------------------------------------------------------------------------
261 //---------------------------------------------------------------------------
263 IMPLEMENT_CLASS(wxGLApp
, wxApp
)
265 bool wxGLApp::InitGLVisual(int *attribList
)