aboutsummaryrefslogtreecommitdiffstats
path: root/src/media
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 /src/media
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
Diffstat (limited to 'src/media')
-rw-r--r--src/media/UVideo.pas18
1 files changed, 15 insertions, 3 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;