fix(opengl): use Lazarus OpenGLContext

Replace OpenGLContextEx with OpenGLContext in MainForm, SpectrumViewOpengl, WaterfallViewOpengl, and WidebandView.

Switch the Lazarus project/program dependencies from LazOpenGLContextEx to LazOpenGLContext in ewsdr.lpi and ewsdr.lpr.

PixelScale was introduced in 092a202; restore the previous viewport/texture path: glViewport(0, 0, W, H), EnsureTexture(W, H), and UploadCurrentRow(W).
This commit is contained in:
2026-07-07 23:30:35 +03:00
parent e13d610a23
commit 004c363df8
6 changed files with 14 additions and 26 deletions
+6 -14
View File
@@ -15,7 +15,7 @@ interface
uses
Classes, SysUtils, Graphics, Controls, Math,
OpenGLContextEx, GL,
OpenGLContext, GL,
AppTheme, WaterfallView;
type
@@ -322,10 +322,8 @@ end;
procedure TWaterfallViewOpenGL.SetWaterfallBitmapSize(W, H: Integer);
begin
if (W <= 0) or (H <= 0) then Exit;
// Ширина текстуры — в физических пикселях (HiDPI): строка водопада должна
// ложиться 1:1 на пиксели фреймбуфера, иначе GL размажет её при увеличении.
if Assigned(FGLControl) and FGLControl.MakeCurrent then
EnsureTexture(Round(W * FGLControl.PixelScale), H);
EnsureTexture(W, H);
FWaterfallDirty := True;
end;
@@ -336,8 +334,7 @@ end;
procedure TWaterfallViewOpenGL.PaintWaterfall(Sender: TObject);
var
W, H, TexW: Integer;
Scale: Double;
W, H: Integer;
R, G, B: GLFloat;
begin
if Sender is TOpenGLControl then FGLControl := TOpenGLControl(Sender);
@@ -345,12 +342,7 @@ begin
W := FGLControl.Width;
H := FGLControl.Height;
if (W <= 0) or (H <= 0) then Exit;
// HiDPI: viewport покрывает весь FBO (физические пиксели), координаты
// остаются логическими; строка водопада строится в физической ширине.
Scale := FGLControl.PixelScale;
TexW := Round(W * Scale);
glViewport(0, 0, TexW, Round(H * Scale));
glViewport(0, 0, W, H);
glMatrixMode(GL_PROJECTION);
glLoadIdentity;
glOrtho(0, W, H, 0, -1, 1);
@@ -365,10 +357,10 @@ begin
glClearColor(R, G, B, 1);
glClear(GL_COLOR_BUFFER_BIT);
EnsureTexture(TexW, H);
EnsureTexture(W, H);
if FWaterfallDirty then
begin
UploadCurrentRow(TexW);
UploadCurrentRow(W);
FWaterfallDirty := False;
end;
DrawTextureWrapped(W, H);