From d142fd8700057ad284e2620076d6716387f3cd63 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 25 Apr 2010 17:14:14 +0000 Subject: wrong usage of glTexEnvi fixed - the environment must be GL_TEXTURE_ENV and not GL_TEXTURE_2D - it must be set before a draw function (glBegin(), ...) and not before glTexImage2D() as the current texture will not store this setting (the setting is global for all textures). - the setting must be set to the default (GL_MODULATE) after usage, otherwise later opengl drawing calls will be unwantedly affected too. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2309 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/menu/UDisplay.pas | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/menu') diff --git a/src/menu/UDisplay.pas b/src/menu/UDisplay.pas index 0b32c6cd..e3ec272a 100644 --- a/src/menu/UDisplay.pas +++ b/src/menu/UDisplay.pas @@ -204,10 +204,9 @@ begin for i := 0 to 1 do begin glBindTexture(GL_TEXTURE_2D, FadeTex[i]); - //glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexImage2D(GL_TEXTURE_2D, 0, 3, TexW, TexH, 0, GL_RGB, GL_UNSIGNED_BYTE, nil); 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; end; @@ -366,6 +365,8 @@ begin FadeH := ScreenH/TexH; glBindTexture(GL_TEXTURE_2D, FadeTex[S-1]); + // TODO: check if glTexEnvi() gives any speed improvement + //glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glColor4f(1, 1, 1, 1-FadeStateSquare); glEnable(GL_TEXTURE_2D); @@ -386,6 +387,9 @@ begin glEnd; glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); + + // reset to default + //glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); end; end -- cgit v1.2.3