From f57b5a260d4d98a910f62316efe653a1a7e704b7 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 1 Mar 2009 12:53:55 +0000 Subject: fixed first screen was cleared when second screen was drawn. #76 should be fixed now commented some weird stuff in TScreenSing.Draw git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1613 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UDraw.pas | 7 ------- src/media/UVideo.pas | 14 ++++++++++++-- src/menu/UMenuBackgroundColor.pas | 6 +++++- src/menu/UMenuBackgroundFade.pas | 10 +++++++--- src/menu/UMenuBackgroundNone.pas | 6 ++++-- src/menu/UMenuBackgroundTexture.pas | 7 +++++-- src/menu/UMenuBackgroundVideo.pas | 6 ++++-- src/screens/UScreenSing.pas | 21 ++++++++++----------- 8 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/base/UDraw.pas b/src/base/UDraw.pas index 6cef5d6b..5de521cd 100644 --- a/src/base/UDraw.pas +++ b/src/base/UDraw.pas @@ -106,10 +106,6 @@ var begin if (ScreenSing.Tex_Background.TexNum > 0) then begin - - glClearColor (1, 1, 1, 1); - glColor4f (1, 1, 1, 1); - if (Ini.MovieSize <= 1) then //HalfSize BG begin (* half screen + gradient *) @@ -682,9 +678,6 @@ begin // FIXME: accessing ScreenSing is not that generic LyricEngine := ScreenSing.Lyrics; - // background //BG Fullsize Mod - //SingDrawBackground; - // draw time-bar SingDrawTimeBar(); diff --git a/src/media/UVideo.pas b/src/media/UVideo.pas index 2d3b7620..35f8ab4d 100644 --- a/src/media/UVideo.pas +++ b/src/media/UVideo.pas @@ -794,8 +794,18 @@ var begin // have a nice black background to draw on // (even if there were errors opening the vid) - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + // TODO: Philipp: IMO TVideoPlayback should not clear the screen at + // all, because clearing is already done by the background class + // at this moment. + if (Screen = 1) then + begin + // It is important that we just clear once before we start + // drawing the first screen otherwise the first screen + // would be cleared by the drawgl called when the second + // screen is drawn + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end; // exit if there's nothing to draw if (not fOpened) then diff --git a/src/menu/UMenuBackgroundColor.pas b/src/menu/UMenuBackgroundColor.pas index 68cf2de4..a5c2a70a 100644 --- a/src/menu/UMenuBackgroundColor.pas +++ b/src/menu/UMenuBackgroundColor.pas @@ -52,7 +52,8 @@ type implementation uses gl, - glext; + glext, + UGraphic; constructor TMenuBackgroundColor.Create(const ThemedSettings: TThemeBackground); begin @@ -62,8 +63,11 @@ end; procedure TMenuBackgroundColor.Draw; begin + if (ScreenAct = 1) then + begin //just clear once, even when using two screens glClearColor(Color.R, Color.G, Color.B, 0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end; end; end. \ No newline at end of file diff --git a/src/menu/UMenuBackgroundFade.pas b/src/menu/UMenuBackgroundFade.pas index b6174738..dc37da45 100644 --- a/src/menu/UMenuBackgroundFade.pas +++ b/src/menu/UMenuBackgroundFade.pas @@ -66,7 +66,8 @@ uses sdl, gl, glext, USkins, - UCommon; + UCommon, + UGraphic; constructor TMenuBackgroundFade.Create(const ThemedSettings: TThemeBackground); var texFilename: string; @@ -121,7 +122,8 @@ begin if (UseTexture) then begin //Draw Texture to Screen - glClear(GL_DEPTH_BUFFER_BIT); + If (ScreenAct = 1) then //Clear just once when in dual screen mode + glClear(GL_DEPTH_BUFFER_BIT); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); @@ -149,7 +151,9 @@ begin end else begin //Clear Screen w/ progress Alpha + Color - glClear(GL_DEPTH_BUFFER_BIT); + If (ScreenAct = 1) then //Clear just once when in dual screen mode + glClear(GL_DEPTH_BUFFER_BIT); + glDisable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/src/menu/UMenuBackgroundNone.pas b/src/menu/UMenuBackgroundNone.pas index 6b63742a..1fccc007 100644 --- a/src/menu/UMenuBackgroundNone.pas +++ b/src/menu/UMenuBackgroundNone.pas @@ -52,7 +52,8 @@ type implementation uses gl, - glext; + glext, + UGraphic; constructor TMenuBackgroundNone.Create(const ThemedSettings: TThemeBackground); begin @@ -62,7 +63,8 @@ end; procedure TMenuBackgroundNone.Draw; begin //Do just nothing in here! - glClear(GL_DEPTH_BUFFER_BIT); + If (ScreenAct = 1) then //Clear just once when in dual screen mode + glClear(GL_DEPTH_BUFFER_BIT); end; end. \ No newline at end of file diff --git a/src/menu/UMenuBackgroundTexture.pas b/src/menu/UMenuBackgroundTexture.pas index e8678fc5..a1b9e88a 100644 --- a/src/menu/UMenuBackgroundTexture.pas +++ b/src/menu/UMenuBackgroundTexture.pas @@ -61,7 +61,8 @@ uses UCommon, SysUtils, gl, - glext; + glext, + UGraphic; constructor TMenuBackgroundTexture.Create(const ThemedSettings: TThemeBackground); var texFilename: string; @@ -92,7 +93,9 @@ end; procedure TMenuBackgroundTexture.Draw; begin - glClear(GL_DEPTH_BUFFER_BIT); + If (ScreenAct = 1) then //Clear just once when in dual screen mode + glClear(GL_DEPTH_BUFFER_BIT); + glColorRGB(Color); glEnable(GL_TEXTURE_2D); diff --git a/src/menu/UMenuBackgroundVideo.pas b/src/menu/UMenuBackgroundVideo.pas index 377c2170..d1ce0f09 100644 --- a/src/menu/UMenuBackgroundVideo.pas +++ b/src/menu/UMenuBackgroundVideo.pas @@ -105,7 +105,8 @@ uses SysUtils, UTime, USkins, - UCommon; + UCommon, + UGraphic; constructor TMenuBackgroundVideo.Create(const ThemedSettings: TThemeBackground); begin @@ -146,7 +147,8 @@ end; procedure TMenuBackgroundVideo.Draw; begin - glClear(GL_DEPTH_BUFFER_BIT); + If (ScreenAct = 1) then //Clear just once when in dual screen mode + glClear(GL_DEPTH_BUFFER_BIT); VideoPlayback.GetFrame(VideoBGTimer.GetTime()); // FIXME: why do we draw on screen 2? Seems to be wrong. diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index da0dc6c9..4e977d66 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -636,7 +636,6 @@ var T: integer; CurLyricsTime: real; begin - Background.Draw; // set player names (for 2 screens and only singstar skin) @@ -675,26 +674,26 @@ begin // will move the statics and texts to the correct screen here. // FIXME: clean up this weird stuff. Commenting this stuff out, nothing // was missing on screen w/ 6 players - so do we even need this stuff? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10 * ScreenX; + {Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10 * ScreenX; - Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; + Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; } {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10 * ScreenX; + {Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10 * ScreenX; - Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; + Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; } {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} // end of weird stuff + { + Static[1].Texture.X := Static[1].Texture.X + 10 * ScreenX; } - Static[1].Texture.X := Static[1].Texture.X + 10 * ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10 * ScreenX; + { for T := 0 to 1 do + Text[T].X := Text[T].X + 10 * ScreenX; } // retrieve current lyrics time, we have to store the value to avoid // that min- and sec-values do not match @@ -770,7 +769,7 @@ begin // will move the statics and texts to the correct screen here. // FIXME: clean up this weird stuff - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10 * ScreenX; + {Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10 * ScreenX; Text[TextP1].X := Text[TextP1].X - 10 * ScreenX; Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10 * ScreenX; @@ -781,7 +780,7 @@ begin Static[1].Texture.X := Static[1].Texture.X - 10 * ScreenX; for T := 0 to 1 do - Text[T].X := Text[T].X - 10 * ScreenX; + Text[T].X := Text[T].X - 10 * ScreenX; } // draw pausepopup // FIXME: this is a workaround that the static is drawn over the lyrics, lines, scores and effects -- cgit v1.2.3