From 6ff85ad711a5ff263563ea3fa922a7206235cae3 Mon Sep 17 00:00:00 2001 From: basisbit Date: Fri, 4 Sep 2015 20:18:28 +0000 Subject: * 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 --- src/menu/UDisplay.pas | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/menu/UDisplay.pas') 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; -- cgit v1.2.3