// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "glcanvas.h"
-#endif
-
#include "wx/wxprec.h"
#if defined(__BORLANDC__)
#include "wx/glcanvas.h"
+#if GL_EXT_vertex_array
+ #define WXUNUSED_WITHOUT_GL_EXT_vertex_array(name) name
+#else
+ #define WXUNUSED_WITHOUT_GL_EXT_vertex_array(name) WXUNUSED(name)
+#endif
+
/*
The following two compiler directives are specific to the Microsoft Visual
C++ family of compilers
{
wglMakeCurrent((HDC) m_hDC, m_glContext);
}
-
- /*
- setupPixelFormat(hDC);
- setupPalette(hDC);
- */
}
void wxGLContext::SetColour(const wxChar *colour)
pfd.iPixelType = PFD_TYPE_RGBA;
break;
case WX_GL_BUFFER_SIZE:
- pfd.cColorBits = attribList[arg++];
+ pfd.cColorBits = (BYTE)attribList[arg++];
break;
case WX_GL_LEVEL:
// this member looks like it may be obsolete
pfd.dwFlags |= PFD_STEREO;
break;
case WX_GL_AUX_BUFFERS:
- pfd.cAuxBuffers = attribList[arg++];
+ pfd.cAuxBuffers = (BYTE)attribList[arg++];
break;
case WX_GL_MIN_RED:
- pfd.cColorBits += (pfd.cRedBits = attribList[arg++]);
+ pfd.cColorBits = (BYTE)(pfd.cColorBits + (pfd.cRedBits = (BYTE)attribList[arg++]));
break;
case WX_GL_MIN_GREEN:
- pfd.cColorBits += (pfd.cGreenBits = attribList[arg++]);
+ pfd.cColorBits = (BYTE)(pfd.cColorBits + (pfd.cGreenBits = (BYTE)attribList[arg++]));
break;
case WX_GL_MIN_BLUE:
- pfd.cColorBits += (pfd.cBlueBits = attribList[arg++]);
+ pfd.cColorBits = (BYTE)(pfd.cColorBits + (pfd.cBlueBits = (BYTE)attribList[arg++]));
break;
case WX_GL_MIN_ALPHA:
// doesn't count in cColorBits
- pfd.cAlphaBits = attribList[arg++];
+ pfd.cAlphaBits = (BYTE)attribList[arg++];
break;
case WX_GL_DEPTH_SIZE:
- pfd.cDepthBits = attribList[arg++];
+ pfd.cDepthBits = (BYTE)attribList[arg++];
break;
case WX_GL_STENCIL_SIZE:
- pfd.cStencilBits = attribList[arg++];
+ pfd.cStencilBits = (BYTE)attribList[arg++];
break;
case WX_GL_MIN_ACCUM_RED:
- pfd.cAccumBits += (pfd.cAccumRedBits = attribList[arg++]);
+ pfd.cAccumBits = (BYTE)(pfd.cAccumBits + (pfd.cAccumRedBits = (BYTE)attribList[arg++]));
break;
case WX_GL_MIN_ACCUM_GREEN:
- pfd.cAccumBits += (pfd.cAccumGreenBits = attribList[arg++]);
+ pfd.cAccumBits = (BYTE)(pfd.cAccumBits + (pfd.cAccumGreenBits = (BYTE)attribList[arg++]));
break;
case WX_GL_MIN_ACCUM_BLUE:
- pfd.cAccumBits += (pfd.cAccumBlueBits = attribList[arg++]);
+ pfd.cAccumBits = (BYTE)(pfd.cAccumBits + (pfd.cAccumBlueBits = (BYTE)attribList[arg++]));
break;
case WX_GL_MIN_ACCUM_ALPHA:
- pfd.cAccumBits += (pfd.cAccumAlphaBits = attribList[arg++]);
+ pfd.cAccumBits = (BYTE)(pfd.cAccumBits + (pfd.cAccumAlphaBits = (BYTE)attribList[arg++]));
break;
default:
break;
PFD_DRAW_TO_WINDOW |
PFD_DOUBLEBUFFER, /* support double-buffering */
PFD_TYPE_RGBA, /* color type */
- 16, /* prefered color depth */
+ 16, /* preferred color depth */
0, 0, 0, 0, 0, 0, /* color bits (ignored) */
0, /* no alpha buffer */
0, /* alpha bits (ignored) */
LOGPALETTE* pPal =
(LOGPALETTE*) malloc(sizeof(LOGPALETTE) + paletteSize * sizeof(PALETTEENTRY));
pPal->palVersion = 0x300;
- pPal->palNumEntries = paletteSize;
+ pPal->palNumEntries = (WORD)paletteSize;
/* build a simple RGB color palette */
{
for (i=0; i<paletteSize; ++i) {
pPal->palPalEntry[i].peRed =
- (((i >> pfd.cRedShift) & redMask) * 255) / redMask;
+ (BYTE)((((i >> pfd.cRedShift) & redMask) * 255) / redMask);
pPal->palPalEntry[i].peGreen =
- (((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask;
+ (BYTE)((((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask);
pPal->palPalEntry[i].peBlue =
- (((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask;
+ (BYTE)((((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask);
pPal->palPalEntry[i].peFlags = 0;
}
}
void wxGLCanvas::SetCurrent()
{
+ // although on MSW it works even if the window is still hidden, it doesn't
+ // under wxGTK and documentation mentions that SetCurrent() can only be
+ // called for a shown window, so check it
+ wxASSERT_MSG( GetParent()->IsShown(),
+ _T("can't make hidden GL canvas current") );
+
if (m_glContext)
{
m_glContext->SetCurrent();
{
}
-void glDrawArraysEXT(GLenum mode, GLint first, GLsizei count)
+void glDrawArraysEXT(GLenum WXUNUSED_WITHOUT_GL_EXT_vertex_array(mode),
+ GLint WXUNUSED_WITHOUT_GL_EXT_vertex_array(first),
+ GLsizei WXUNUSED_WITHOUT_GL_EXT_vertex_array(count))
{
#ifdef GL_EXT_vertex_array
static PFNGLDRAWARRAYSEXTPROC proc = 0;
{
}
-void glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
+void glNormalPointerEXT(GLenum WXUNUSED_WITHOUT_GL_EXT_vertex_array(type),
+ GLsizei WXUNUSED_WITHOUT_GL_EXT_vertex_array(stride),
+ GLsizei WXUNUSED_WITHOUT_GL_EXT_vertex_array(count),
+ const GLvoid *WXUNUSED_WITHOUT_GL_EXT_vertex_array(pointer))
{
#ifdef GL_EXT_vertex_array
static PFNGLNORMALPOINTEREXTPROC proc = 0;
{
}
-void glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer)
+void glVertexPointerEXT(GLint WXUNUSED_WITHOUT_GL_EXT_vertex_array(size),
+ GLenum WXUNUSED_WITHOUT_GL_EXT_vertex_array(type),
+ GLsizei WXUNUSED_WITHOUT_GL_EXT_vertex_array(stride),
+ GLsizei WXUNUSED_WITHOUT_GL_EXT_vertex_array(count),
+ const GLvoid *WXUNUSED_WITHOUT_GL_EXT_vertex_array(pointer))
{
#ifdef GL_EXT_vertex_array
static PFNGLVERTEXPOINTEREXTPROC proc = 0;
PFD_DRAW_TO_WINDOW |
PFD_DOUBLEBUFFER, /* support double-buffering */
PFD_TYPE_RGBA, /* color type */
- 16, /* prefered color depth */
+ 16, /* preferred color depth */
0, 0, 0, 0, 0, 0, /* color bits (ignored) */
0, /* no alpha buffer */
0, /* alpha bits (ignored) */