merged 2.2 branch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -49,7 +49,7 @@ wxGLContext::wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette)
|
||||
m_hDC = win->GetHDC();
|
||||
|
||||
m_glContext = wglCreateContext((HDC) m_hDC);
|
||||
wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" );
|
||||
wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") );
|
||||
|
||||
wglMakeCurrent((HDC) m_hDC, m_glContext);
|
||||
}
|
||||
@@ -65,7 +65,7 @@ wxGLContext::wxGLContext(
|
||||
m_hDC = win->GetHDC();
|
||||
|
||||
m_glContext = wglCreateContext((HDC) m_hDC);
|
||||
wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" );
|
||||
wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") );
|
||||
|
||||
if( other != 0 )
|
||||
wglShareLists( other->m_glContext, m_glContext );
|
||||
@@ -179,7 +179,7 @@ wxGLCanvas::wxGLCanvas( wxWindow *parent,
|
||||
m_glContext = new wxGLContext(TRUE, this, palette, shared );
|
||||
}
|
||||
|
||||
// Not very usefull for wxMSW, but this is to be wxGTK compliant
|
||||
// Not very useful for wxMSW, but this is to be wxGTK compliant
|
||||
|
||||
wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
||||
@@ -218,6 +218,17 @@ wxGLCanvas::~wxGLCanvas()
|
||||
bool wxGLCanvas::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
||||
{
|
||||
/* Suggestion from Kelly Brock <kbrock@8cs.com> (not yet implemented):
|
||||
|
||||
OpenGL corruption fix is simple assuming it doesn't screw anything else
|
||||
up. Add the following line to the top of the create function:
|
||||
wxSize parentSize = GetClientSize();
|
||||
All locations within the function that use 'size' are changed to
|
||||
'parentSize'.
|
||||
The above corrects the initial display corruption with the GeForce and
|
||||
TNT2, not sure about other NVidia cards yet.
|
||||
*/
|
||||
|
||||
static bool registeredGLCanvasClass = FALSE;
|
||||
|
||||
// We have to register a special window class because we need
|
||||
@@ -262,7 +273,7 @@ bool wxGLCanvas::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
if ( !RegisterClass(&wndclass) )
|
||||
{
|
||||
wxLogLastError("RegisterClass(wxGLCanvasClass)");
|
||||
wxLogLastError(wxT("RegisterClass(wxGLCanvasClass)"));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -282,9 +293,17 @@ bool wxGLCanvas::Create(wxWindow *parent, wxWindowID id,
|
||||
if ( style & wxTHICK_FRAME )
|
||||
msflags |= WS_THICKFRAME;
|
||||
|
||||
msflags |= WS_CHILD | WS_VISIBLE;
|
||||
if ( style & wxCLIP_CHILDREN )
|
||||
msflags |= WS_CLIPCHILDREN;
|
||||
/*
|
||||
A general rule with OpenGL and Win32 is that any window that will have a
|
||||
HGLRC built for it must have two flags: WS_CLIPCHILDREN & WS_CLIPSIBLINGS.
|
||||
You can find references about this within the knowledge base and most OpenGL
|
||||
books that contain the wgl function descriptions.
|
||||
*/
|
||||
|
||||
msflags |= WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS;
|
||||
// if ( style & wxCLIP_CHILDREN )
|
||||
// msflags |= WS_CLIPCHILDREN;
|
||||
msflags |= WS_CLIPCHILDREN;
|
||||
|
||||
bool want3D;
|
||||
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D);
|
||||
@@ -340,13 +359,13 @@ void wxGLCanvas::SetupPixelFormat() // (HDC hDC)
|
||||
|
||||
pixelFormat = ChoosePixelFormat((HDC) m_hDC, &pfd);
|
||||
if (pixelFormat == 0) {
|
||||
MessageBox(WindowFromDC((HDC) m_hDC), "ChoosePixelFormat failed.", "Error",
|
||||
MessageBox(WindowFromDC((HDC) m_hDC), wxT("ChoosePixelFormat failed."), wxT("Error"),
|
||||
MB_ICONERROR | MB_OK);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (SetPixelFormat((HDC) m_hDC, pixelFormat, &pfd) != TRUE) {
|
||||
MessageBox(WindowFromDC((HDC) m_hDC), "SetPixelFormat failed.", "Error",
|
||||
MessageBox(WindowFromDC((HDC) m_hDC), wxT("SetPixelFormat failed."), wxT("Error"),
|
||||
MB_ICONERROR | MB_OK);
|
||||
exit(1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user