Added OpenGLControl.OnResize handler to re-init OpenGL

main
Stefan Müller 8 months ago
parent 4b3b57d710
commit 5d63d8c2ef

@ -17,5 +17,6 @@ object MainForm: TMainForm
Align = alClient
OnClick = OpenGLControlClick
OnPaint = OpenGLControlPaint
OnResize = OpenGLControlResize
end
end

@ -18,6 +18,7 @@ type
procedure FormDestroy(Sender: TObject);
procedure OpenGLControlClick(Sender: TObject);
procedure OpenGLControlPaint(Sender: TObject);
procedure OpenGLControlResize(Sender: TObject);
private
FView: TView;
public
@ -70,5 +71,19 @@ begin
OpenGLControl.SwapBuffers;
end;
procedure TMainForm.OpenGLControlResize(Sender: TObject);
begin
//scaling := FDrawing.Scaling;
FView.OpenGLInit(True);
// TODO: It seems that a call to Reset should not be necessary, which then should also make the scaling changes irrelevant.
//FView.Reset;
// TODO: Restore previous zoom.
// ScaleView(scaling);
// Redraws control, but only if form is shown.
if (fsShowing in FormState) then
OpenGLControl.Repaint;
end;
end.

Loading…
Cancel
Save