mirror of
https://git.vladimir.cc/vladimir/lazopenglcontextex.git
synced 2026-08-26 01:37:37 +00:00
feat: TCustomOpenGLControl.PixelScale — devicePixelRatio для HiDPI
LOpenGLPixelScale в Qt-бэкенде (QLCLGLWidget_devicePixelRatioF), на прочих бэкендах возвращает 1.0. Нужен коду с явными glViewport и текстурами в физических пикселях. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -166,6 +166,9 @@ type
|
||||
procedure SwapBuffers; virtual;
|
||||
function MakeCurrent(SaveOldToStack: boolean = false): boolean; virtual;
|
||||
function ReleaseContext: boolean; virtual;
|
||||
// devicePixelRatio фреймбуфера (HiDPI). 1.0 на бэкендах без поддержки.
|
||||
// Явные glViewport/текстуры в пользовательском коде должны умножать на него.
|
||||
function PixelScale: Double;
|
||||
function RestoreOldOpenGLControl: boolean;
|
||||
function SharingControlCount: integer;
|
||||
property SharingControls[Index: integer]: TCustomOpenGLControl read GetSharingControls;
|
||||
@@ -643,6 +646,15 @@ begin
|
||||
Result:=LOpenGLReleaseContext(Handle);
|
||||
end;
|
||||
|
||||
function TCustomOpenGLControl.PixelScale: Double;
|
||||
begin
|
||||
Result:=1.0;
|
||||
{$IFDEF UseQtNative}
|
||||
if HandleAllocated then
|
||||
Result:=LOpenGLPixelScale(Handle);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TCustomOpenGLControl.RestoreOldOpenGLControl: boolean;
|
||||
var
|
||||
RestoredControl: TCustomOpenGLControl;
|
||||
|
||||
Reference in New Issue
Block a user