From d58efe052081f5cfc2bb5c211d9129c5d7d9aab7 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Fri, 22 Oct 2010 14:52:16 +0000 Subject: disable blending after drawing of particles git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2688 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UGraphicClasses.pas | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src/base') diff --git a/src/base/UGraphicClasses.pas b/src/base/UGraphicClasses.pas index cdaa238e..55d91e39 100644 --- a/src/base/UGraphicClasses.pas +++ b/src/base/UGraphicClasses.pas @@ -356,25 +356,31 @@ procedure TParticle.Draw; var L: cardinal; begin - if ScreenAct = Screen then + if (ScreenAct = Screen) then + begin + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, Tex); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + // this draws (multiple) texture(s) of our particle for L := 0 to High(Col) do begin glColor4f(Col[L].r, Col[L].g, Col[L].b, Alpha); - glBindTexture(GL_TEXTURE_2D, Tex); - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glTexCoord2f((1/16) * Frame, 0); glVertex2f(X-W*Scale[L]*SizeMod, Y-H*Scale[L]*SizeMod); - glTexCoord2f((1/16) * Frame + (1/16), 0); glVertex2f(X-W*Scale[L]*SizeMod, Y+H*Scale[L]*SizeMod); - glTexCoord2f((1/16) * Frame + (1/16), 1); glVertex2f(X+W*Scale[L]*SizeMod, Y+H*Scale[L]*SizeMod); - glTexCoord2f((1/16) * Frame, 1); glVertex2f(X+W*Scale[L]*SizeMod, Y-H*Scale[L]*SizeMod); + glTexCoord2f((1/16) * Frame, 0); glVertex2f(X-W*Scale[L]*SizeMod, Y-H*Scale[L]*SizeMod); + glTexCoord2f((1/16) * Frame + (1/16), 0); glVertex2f(X-W*Scale[L]*SizeMod, Y+H*Scale[L]*SizeMod); + glTexCoord2f((1/16) * Frame + (1/16), 1); glVertex2f(X+W*Scale[L]*SizeMod, Y+H*Scale[L]*SizeMod); + glTexCoord2f((1/16) * Frame, 1); glVertex2f(X+W*Scale[L]*SizeMod, Y-H*Scale[L]*SizeMod); glEnd; end; - glcolor4f(1,1,1,1); + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, 0); + glcolor4f(1,1,1,1); + end; end; // end of TParticle -- cgit v1.2.3