Fix opengl errors when the file is modified with a minimized detached video window open
Originally committed to SVN as r6257.
This commit is contained in:
parent
93c96d1f82
commit
cd48b711b4
1 changed files with 12 additions and 4 deletions
|
@ -140,10 +140,17 @@ VideoDisplay::~VideoDisplay () {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoDisplay::InitContext() {
|
bool VideoDisplay::InitContext() {
|
||||||
if (!IsShownOnScreen()) return false;
|
if (!IsShownOnScreen())
|
||||||
if (!glContext.get()) {
|
return false;
|
||||||
|
|
||||||
|
// If this display is in a minimized detached dialog IsShownOnScreen will
|
||||||
|
// return true, but the client size is guaranteed to be 0
|
||||||
|
if (GetClientSize() == wxSize(0, 0))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!glContext)
|
||||||
glContext.reset(new wxGLContext(this));
|
glContext.reset(new wxGLContext(this));
|
||||||
}
|
|
||||||
SetCurrent(*glContext.get());
|
SetCurrent(*glContext.get());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +190,8 @@ void VideoDisplay::OnVideoOpen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDisplay::Render() try {
|
void VideoDisplay::Render() try {
|
||||||
if (!InitContext() || !con->videoController->IsLoaded() || !videoOut) return;
|
if (!InitContext() || !con->videoController->IsLoaded() || !videoOut)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!viewport_height || !viewport_width)
|
if (!viewport_height || !viewport_width)
|
||||||
UpdateSize();
|
UpdateSize();
|
||||||
|
|
Loading…
Reference in a new issue