aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbasisbit <basisbit@b956fd51-792f-4845-bead-9b4dfca2ff2c>2015-09-04 20:18:28 +0000
committerbasisbit <basisbit@b956fd51-792f-4845-bead-9b4dfca2ff2c>2015-09-04 20:18:28 +0000
commit6ff85ad711a5ff263563ea3fa922a7206235cae3 (patch)
treea9132f28d6baafb00dade9e4734ff1f43897663a
parentebac563f0f8f4fba120cee79e8e6a7973e394677 (diff)
downloadusdx-6ff85ad711a5ff263563ea3fa922a7206235cae3.tar.gz
usdx-6ff85ad711a5ff263563ea3fa922a7206235cae3.tar.xz
usdx-6ff85ad711a5ff263563ea3fa922a7206235cae3.zip
* if NPOT is supported by the graphics card driver, do not manually resize videos and textures to a power of 2 with and hight. This slightly improves image quality because of less resizing (OpenGL handles this better anyways) and is a minor performance improvement on systems that support OpenGL 2.x or newer.
* please test this release and report bugs in the sourceforge forum or preferably our IRC channel git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3129 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--src/media/UVideo.pas18
-rw-r--r--src/menu/UDisplay.pas18
-rw-r--r--src/screens/UScreenJukebox.pas3
3 files changed, 29 insertions, 10 deletions
diff --git a/src/media/UVideo.pas b/src/media/UVideo.pas
index e6019827..7a3d066b 100644
--- a/src/media/UVideo.pas
+++ b/src/media/UVideo.pas
@@ -67,6 +67,7 @@ uses
glu,
glext,
textgl,
+ StrUtils,
UMediaCore_FFmpeg,
UCommon,
UConfig,
@@ -237,6 +238,7 @@ type
var
FFmpegCore: TMediaCore_FFmpeg;
+ SupportsNPOT: Boolean;
// These are called whenever we allocate a frame buffer.
@@ -310,6 +312,7 @@ end;
constructor TVideo_FFmpeg.Create;
begin
glGenTextures(1, PGLuint(@fFrameTex));
+ SupportsNPOT := AnsiContainsStr(glGetString(GL_EXTENSIONS),'texture_non_power_of_two');
Reset();
end;
@@ -494,8 +497,17 @@ begin
end;
{$ENDIF}
- fTexWidth := Round(Power(2, Ceil(Log2(fCodecContext^.width))));
- fTexHeight := Round(Power(2, Ceil(Log2(fCodecContext^.height))));
+ if (SupportsNPOT = false) then
+ begin
+ fTexWidth := Round(Power(2, Ceil(Log2(fCodecContext^.width))));
+ fTexHeight := Round(Power(2, Ceil(Log2(fCodecContext^.height))));
+ end
+ else
+ begin
+ fTexWidth := fCodecContext^.width;
+ fTexHeight := fCodecContext^.height;
+ end;
+
if (fPboEnabled) then
begin
@@ -523,7 +535,7 @@ begin
glBindTexture(GL_TEXTURE_2D, fFrameTex);
glTexImage2D(GL_TEXTURE_2D, 0, 3, fTexWidth, fTexHeight, 0,
PIXEL_FMT_OPENGL, GL_UNSIGNED_BYTE, nil);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
fOpened := true;
diff --git a/src/menu/UDisplay.pas b/src/menu/UDisplay.pas
index 3dba08fe..fe833e43 100644
--- a/src/menu/UDisplay.pas
+++ b/src/menu/UDisplay.pas
@@ -127,6 +127,7 @@ type
var
Display: TDisplay;
+ SupportsNPOT: Boolean;
const
{ constants for screen transition
@@ -142,6 +143,7 @@ implementation
uses
TextGL,
+ StrUtils,
UCommandLine,
UGraphic,
UIni,
@@ -174,6 +176,7 @@ begin
DoneOnShow := false;
glGenTextures(2, PGLuint(@FadeTex));
+ SupportsNPOT := AnsiContainsStr(glGetString(GL_EXTENSIONS),'texture_non_power_of_two');
InitFadeTextures();
// set LastError for OSD to No Error
@@ -199,13 +202,20 @@ procedure TDisplay.InitFadeTextures();
var
i: integer;
begin
- TexW := Round(Power(2, Ceil(Log2(ScreenW div Screens))));
- TexH := Round(Power(2, Ceil(Log2(ScreenH))));
-
+ if (SupportsNPOT = false) then
+ begin
+ TexW := Round(Power(2, Ceil(Log2(ScreenW div Screens))));
+ TexH := Round(Power(2, Ceil(Log2(ScreenH))));
+ end
+ else
+ begin
+ TexW := ScreenW div Screens;
+ TexH := ScreenH;
+ end;
for i := 0 to 1 do
begin
glBindTexture(GL_TEXTURE_2D, FadeTex[i]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TexW, TexH, 0, GL_RGB, GL_UNSIGNED_BYTE, nil);
end;
diff --git a/src/screens/UScreenJukebox.pas b/src/screens/UScreenJukebox.pas
index de35bc2a..8e4b7712 100644
--- a/src/screens/UScreenJukebox.pas
+++ b/src/screens/UScreenJukebox.pas
@@ -1713,9 +1713,6 @@ begin
Lyrics.AddLine(@Lines[0].Line[Lyrics.LineCounter]);
end;
- //Text[JukeboxTextSongText].Visible := true;
- //Text[JukeboxTextSongText].Text := CurrentSong.Artist + ' - ' + CurrentSong.Title;
-
Max := 9;
if (High(JukeboxVisibleSongs) < 9) then