OpenGLContext: Make TOpenGLControl renderable by a thread. Issue #32116, patch from Pascal Riekenberg.

git-svn-id: trunk@55559 -
This commit is contained in:
juha 2017-07-22 07:22:30 +00:00
parent 69e95d6c6d
commit 712e063538

View File

@ -566,9 +566,10 @@ begin
if IsVisible and HandleAllocated then begin if IsVisible and HandleAllocated then begin
UpdateFrameTimeDiff; UpdateFrameTimeDiff;
if IsOpenGLRenderAllowed and ([csDestroying]*ComponentState=[]) then begin if IsOpenGLRenderAllowed and ([csDestroying]*ComponentState=[]) then begin
if not MakeCurrent then exit; if AutoResizeViewport then begin
if AutoResizeViewport then if not MakeCurrent then exit;
LOpenGLViewport(Handle,0,0,Width,Height); LOpenGLViewport(Handle,0,0,Width,Height);
end;
end; end;
//LOpenGLClip(Handle); //LOpenGLClip(Handle);
DoOnPaint; DoOnPaint;
@ -589,7 +590,10 @@ end;
procedure TCustomOpenGLControl.DoOnPaint; procedure TCustomOpenGLControl.DoOnPaint;
begin begin
if Assigned(OnPaint) then OnPaint(Self); if Assigned(OnPaint) then begin
if not MakeCurrent then exit;
OnPaint(Self);
end;
end; end;
procedure TCustomOpenGLControl.SwapBuffers; procedure TCustomOpenGLControl.SwapBuffers;