mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
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:
+2
-3
@@ -25,7 +25,7 @@ uses
|
|||||||
Classes, SysUtils, StrUtils, FreqDisplay, DeviceForm, VfoOverlay, SampleRateOverlay, BandPlanOverlay,
|
Classes, SysUtils, StrUtils, FreqDisplay, DeviceForm, VfoOverlay, SampleRateOverlay, BandPlanOverlay,
|
||||||
FlatButton, FlatSlider, FlatDropDown, AppTheme, Forms, Controls, Graphics, Dialogs,
|
FlatButton, FlatSlider, FlatDropDown, AppTheme, Forms, Controls, Graphics, Dialogs,
|
||||||
StdCtrls, ExtCtrls, Buttons, Menus, Math, Types,
|
StdCtrls, ExtCtrls, Buttons, Menus, Math, Types,
|
||||||
OpenGLContextEx,
|
OpenGLContext,
|
||||||
LCLIntf, LCLType, GraphType,
|
LCLIntf, LCLType, GraphType,
|
||||||
HPSDRProtocol, HPSDRNetwork,
|
HPSDRProtocol, HPSDRNetwork,
|
||||||
WDSP, WDSPEngine, AudioOutput, AudioInput,
|
WDSP, WDSPEngine, AudioOutput, AudioInput,
|
||||||
@@ -1004,8 +1004,7 @@ begin
|
|||||||
FSplitterRatio := 0.40;
|
FSplitterRatio := 0.40;
|
||||||
FSplitterDrag := False;
|
FSplitterDrag := False;
|
||||||
|
|
||||||
// OpenGLContextEx (QOpenGLWidget-бэкенд) работает и в нативном Wayland,
|
// Штатный Lazarus OpenGLContext включается только явным ключом --opengl.
|
||||||
// старая X11-заглушка больше не нужна
|
|
||||||
FUseOpenGLSpectrum := HasOpenGLSpectrumSwitch;
|
FUseOpenGLSpectrum := HasOpenGLSpectrumSwitch;
|
||||||
if FUseOpenGLSpectrum then
|
if FUseOpenGLSpectrum then
|
||||||
FSpecView := TSpectrumViewOpenGL.Create
|
FSpecView := TSpectrumViewOpenGL.Create
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Graphics, Controls, Math, Types,
|
Classes, SysUtils, Graphics, Controls, Math, Types,
|
||||||
OpenGLContextEx, GL,
|
OpenGLContext, GL,
|
||||||
AppTheme, SpectrumView, VfoOverlay, BandPlanOverlay,
|
AppTheme, SpectrumView, VfoOverlay, BandPlanOverlay,
|
||||||
WaterfallView, WaterfallViewOpengl;
|
WaterfallView, WaterfallViewOpengl;
|
||||||
|
|
||||||
@@ -980,9 +980,7 @@ begin
|
|||||||
H := FGLControl.Height;
|
H := FGLControl.Height;
|
||||||
if (W <= 0) or (H <= 0) then Exit;
|
if (W <= 0) or (H <= 0) then Exit;
|
||||||
|
|
||||||
// HiDPI: viewport в физических пикселях FBO, координаты — логические
|
glViewport(0, 0, W, H);
|
||||||
glViewport(0, 0, Round(W * FGLControl.PixelScale),
|
|
||||||
Round(H * FGLControl.PixelScale));
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity;
|
glLoadIdentity;
|
||||||
glOrtho(0, W, H, 0, -1, 1);
|
glOrtho(0, W, H, 0, -1, 1);
|
||||||
|
|||||||
+6
-14
@@ -15,7 +15,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Graphics, Controls, Math,
|
Classes, SysUtils, Graphics, Controls, Math,
|
||||||
OpenGLContextEx, GL,
|
OpenGLContext, GL,
|
||||||
AppTheme, WaterfallView;
|
AppTheme, WaterfallView;
|
||||||
|
|
||||||
type
|
type
|
||||||
@@ -322,10 +322,8 @@ end;
|
|||||||
procedure TWaterfallViewOpenGL.SetWaterfallBitmapSize(W, H: Integer);
|
procedure TWaterfallViewOpenGL.SetWaterfallBitmapSize(W, H: Integer);
|
||||||
begin
|
begin
|
||||||
if (W <= 0) or (H <= 0) then Exit;
|
if (W <= 0) or (H <= 0) then Exit;
|
||||||
// Ширина текстуры — в физических пикселях (HiDPI): строка водопада должна
|
|
||||||
// ложиться 1:1 на пиксели фреймбуфера, иначе GL размажет её при увеличении.
|
|
||||||
if Assigned(FGLControl) and FGLControl.MakeCurrent then
|
if Assigned(FGLControl) and FGLControl.MakeCurrent then
|
||||||
EnsureTexture(Round(W * FGLControl.PixelScale), H);
|
EnsureTexture(W, H);
|
||||||
FWaterfallDirty := True;
|
FWaterfallDirty := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -336,8 +334,7 @@ end;
|
|||||||
|
|
||||||
procedure TWaterfallViewOpenGL.PaintWaterfall(Sender: TObject);
|
procedure TWaterfallViewOpenGL.PaintWaterfall(Sender: TObject);
|
||||||
var
|
var
|
||||||
W, H, TexW: Integer;
|
W, H: Integer;
|
||||||
Scale: Double;
|
|
||||||
R, G, B: GLFloat;
|
R, G, B: GLFloat;
|
||||||
begin
|
begin
|
||||||
if Sender is TOpenGLControl then FGLControl := TOpenGLControl(Sender);
|
if Sender is TOpenGLControl then FGLControl := TOpenGLControl(Sender);
|
||||||
@@ -345,12 +342,7 @@ begin
|
|||||||
W := FGLControl.Width;
|
W := FGLControl.Width;
|
||||||
H := FGLControl.Height;
|
H := FGLControl.Height;
|
||||||
if (W <= 0) or (H <= 0) then Exit;
|
if (W <= 0) or (H <= 0) then Exit;
|
||||||
// HiDPI: viewport покрывает весь FBO (физические пиксели), координаты
|
glViewport(0, 0, W, H);
|
||||||
// остаются логическими; строка водопада строится в физической ширине.
|
|
||||||
Scale := FGLControl.PixelScale;
|
|
||||||
TexW := Round(W * Scale);
|
|
||||||
|
|
||||||
glViewport(0, 0, TexW, Round(H * Scale));
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity;
|
glLoadIdentity;
|
||||||
glOrtho(0, W, H, 0, -1, 1);
|
glOrtho(0, W, H, 0, -1, 1);
|
||||||
@@ -365,10 +357,10 @@ begin
|
|||||||
glClearColor(R, G, B, 1);
|
glClearColor(R, G, B, 1);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
EnsureTexture(TexW, H);
|
EnsureTexture(W, H);
|
||||||
if FWaterfallDirty then
|
if FWaterfallDirty then
|
||||||
begin
|
begin
|
||||||
UploadCurrentRow(TexW);
|
UploadCurrentRow(W);
|
||||||
FWaterfallDirty := False;
|
FWaterfallDirty := False;
|
||||||
end;
|
end;
|
||||||
DrawTextureWrapped(W, H);
|
DrawTextureWrapped(W, H);
|
||||||
|
|||||||
+2
-3
@@ -18,7 +18,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Math, Graphics, Controls, ExtCtrls,
|
Classes, SysUtils, Math, Graphics, Controls, ExtCtrls,
|
||||||
OpenGLContextEx, GL, AppTheme, WDSP;
|
OpenGLContext, GL, AppTheme, WDSP;
|
||||||
|
|
||||||
type
|
type
|
||||||
TWidebandView = class
|
TWidebandView = class
|
||||||
@@ -1077,8 +1077,7 @@ begin
|
|||||||
UploadLabelTextureToGL;
|
UploadLabelTextureToGL;
|
||||||
FGLBackgroundDirty := False;
|
FGLBackgroundDirty := False;
|
||||||
end;
|
end;
|
||||||
// HiDPI: viewport в физических пикселях FBO, координаты — логические
|
glViewport(0, 0, W, H);
|
||||||
glViewport(0, 0, Round(W * C.PixelScale), Round(H * C.PixelScale));
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity;
|
glLoadIdentity;
|
||||||
glOrtho(0, W, 0, H, -1, 1);
|
glOrtho(0, W, 0, H, -1, 1);
|
||||||
|
|||||||
@@ -141,7 +141,7 @@
|
|||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages>
|
<RequiredPackages>
|
||||||
<Item>
|
<Item>
|
||||||
<PackageName Value="LazOpenGLContextEx"/>
|
<PackageName Value="LazOpenGLContext"/>
|
||||||
</Item>
|
</Item>
|
||||||
<Item>
|
<Item>
|
||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ uses
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Interfaces, // LCL platform
|
Interfaces, // LCL platform
|
||||||
WindowsDPI,
|
WindowsDPI,
|
||||||
Forms, LazOpenGLContextEx,
|
Forms, LazOpenGLContext,
|
||||||
MainForm, AudioOutput, DeviceForm, FlatButton, FreqDisplay, VfoOverlay,
|
MainForm, AudioOutput, DeviceForm, FlatButton, FreqDisplay, VfoOverlay,
|
||||||
WDSP, WDSPEngine, WebPageHtml, WebServer, WebUtils, WinFirewall, WsClient,
|
WDSP, WDSPEngine, WebPageHtml, WebServer, WebUtils, WinFirewall, WsClient,
|
||||||
Settings, RadioController;
|
Settings, RadioController;
|
||||||
|
|||||||
Reference in New Issue
Block a user