Skip to content

Commit

Permalink
Merge pull request #544 from dellis1972/develop
Browse files Browse the repository at this point in the history
Fix to stop the flickering on the emulator when using gles 1.1
  • Loading branch information
CartBlanche committed Jun 20, 2012
2 parents 6529eae + 2394f57 commit 4952f59
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions MonoGame.Framework/Android/AndroidGamePlatform.cs
Expand Up @@ -80,7 +80,9 @@ 1. Definitions

using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Media;

using GL11 = OpenTK.Graphics.ES11.GL;

namespace Microsoft.Xna.Framework
{
Expand All @@ -95,9 +97,13 @@ public AndroidGamePlatform(Game game)
AndroidGameActivity.Resumed += Activity_Resumed;

Window = new AndroidGameWindow(Game.Activity, game);

string model = Android.OS.Build.Model;
runningOnEmulator = string.IsNullOrEmpty(model) ? false : model.Contains("sdk");
}

private bool _initialized;
private bool runningOnEmulator = false;
public static bool IsPlayingVdeo { get; set; }

public override void Exit()
Expand Down Expand Up @@ -230,8 +236,22 @@ public override void ResetElapsedTime ()
public override void Present()
{
try
{
Window.SwapBuffers();
{
if (this.Window.GLContextVersion == OpenTK.Graphics.GLContextVersion.Gles2_0)
{
Window.SwapBuffers();
}
else
{
if (!runningOnEmulator)
{
Window.SwapBuffers();
}
else
{
GL11.Flush();
}
}
}
catch (Exception ex)
{
Expand Down

0 comments on commit 4952f59

Please sign in to comment.