{"action":"created","issue":{"url":"https://api.github.com/repos/MonoGame/MonoGame/issues/6542","repository_url":"https://api.github.com/repos/MonoGame/MonoGame","labels_url":"https://api.github.com/repos/MonoGame/MonoGame/issues/6542/labels{/name}","comments_url":"https://api.github.com/repos/MonoGame/MonoGame/issues/6542/comments","events_url":"https://api.github.com/repos/MonoGame/MonoGame/issues/6542/events","html_url":"https://github.com/MonoGame/MonoGame/issues/6542","id":381559330,"node_id":"MDU6SXNzdWUzODE1NTkzMzA=","number":6542,"title":"Slight stuttering issue","user":{"login":"srodrigo","id":5873601,"node_id":"MDQ6VXNlcjU4NzM2MDE=","avatar_url":"https://avatars1.githubusercontent.com/u/5873601?v=4","gravatar_id":"","url":"https://api.github.com/users/srodrigo","html_url":"https://github.com/srodrigo","followers_url":"https://api.github.com/users/srodrigo/followers","following_url":"https://api.github.com/users/srodrigo/following{/other_user}","gists_url":"https://api.github.com/users/srodrigo/gists{/gist_id}","starred_url":"https://api.github.com/users/srodrigo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srodrigo/subscriptions","organizations_url":"https://api.github.com/users/srodrigo/orgs","repos_url":"https://api.github.com/users/srodrigo/repos","events_url":"https://api.github.com/users/srodrigo/events{/privacy}","received_events_url":"https://api.github.com/users/srodrigo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-11-16T11:24:43Z","updated_at":"2018-11-16T20:59:25Z","closed_at":null,"author_association":"NONE","body":"<!--\r\n# Please make sure that the issue is present in the\r\n# develop branch of MonoGame before reporting\r\n#\r\n# You can download the development build installer from:\r\n# http://www.monogame.net/downloads/\r\n-->\r\n\r\n<!-- Write your issue below -->\r\n\r\nI get a slight stuttering problem on a very basic example (just a 16x32 texture moving through the screen).\r\n\r\nI'm printing out the elapsed seconds on the Draw method. The rate seems to be unstable (with 0.0333334 peaks, sometimes more, instead of the -I assume- expected 0.0166667). Please find\r\n the attached file: [stutter.txt](https://github.com/MonoGame/MonoGame/files/2589036/stutter.txt).\r\n\r\nThe elapsed seconds on the Update method seem to be stable (0.0166667), as expected.\r\n\r\nI've noticed the issue gets worse if I have an external screen plugged in (so the graphics card is doing more work), but, as discussed with @MichaelDePiazzi, this should still work fine.\r\n\r\nThis is the source code:\r\n\r\n```C#\r\nusing System.Diagnostics;\r\nusing Microsoft.Xna.Framework;\r\nusing Microsoft.Xna.Framework.Graphics;\r\nusing Microsoft.Xna.Framework.Input;\r\n\r\nnamespace Stuttering.MacOS\r\n{\r\n    public class Game1 : Game\r\n    {\r\n        GraphicsDeviceManager graphics;\r\n        SpriteBatch spriteBatch;\r\n\r\n        Texture2D texture;\r\n        Point enemy = new Point(0, 0);\r\n        \r\n        const int WIDTH = 2 * 640;\r\n        const int HEIGHT = 2 * 360;\r\n        \r\n        public Game1()\r\n        {\r\n            graphics = new GraphicsDeviceManager(this)\r\n            {\r\n                PreferredBackBufferWidth = WIDTH,\r\n                PreferredBackBufferHeight = HEIGHT\r\n            };\r\n            Content.RootDirectory = \"Content\";\r\n        }\r\n\r\n        protected override void Initialize()\r\n        {\r\n            base.Initialize();\r\n        }\r\n        \r\n        protected override void LoadContent()\r\n        {\r\n            spriteBatch = new SpriteBatch(GraphicsDevice);\r\n            \r\n            texture = Content.Load<Texture2D>(\"enemy-1\");\r\n        }\r\n        \r\n        protected override void Update(GameTime gameTime)\r\n        {\r\n            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))\r\n                Exit();\r\n\r\n            enemy += new Point((int)(200.0f * gameTime.ElapsedGameTime.TotalSeconds), 0);\r\n\r\n            base.Update(gameTime);\r\n        }\r\n\r\n        protected override void Draw(GameTime gameTime)\r\n        {\r\n            Debug.WriteLine(\"Draw - gametime total seconds: \" + gameTime.ElapsedGameTime.TotalSeconds);\r\n            graphics.GraphicsDevice.Clear(Color.Black);\r\n\r\n            spriteBatch.Begin();\r\n            spriteBatch.Draw(texture, enemy.ToVector2(), Color.White);\r\n            spriteBatch.End();\r\n\r\n            base.Draw(gameTime);\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nI wanted to narrow it down to the minimum, but in case this helps, I include another file \r\n[Game1.txt](https://github.com/MonoGame/MonoGame/files/2589059/Game1.txt) with the texture changing direction when reaching the screen bounds (this makes it easier to see, as sometimes it takes a few seconds). Also, the texture is scaled to make it easier to see, but this shouldn't affect the performance much?\r\n\r\n<!-- System stats -->\r\n\r\n#### What version of MonoGame does the bug occur on:\r\n- 3.8.0.132\r\n\r\n#### What operating system are you using:\r\n- Mac\r\n\r\n#### What MonoGame platform are you using:\r\n<!-- e.g. DesktopGL, WindowsDX, WindowsUWP, Android -->\r\n- DesktopGL\r\n"},"comment":{"url":"https://api.github.com/repos/MonoGame/MonoGame/issues/comments/439525497","html_url":"https://github.com/MonoGame/MonoGame/issues/6542#issuecomment-439525497","issue_url":"https://api.github.com/repos/MonoGame/MonoGame/issues/6542","id":439525497,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTUyNTQ5Nw==","user":{"login":"HopefulToad","id":14949963,"node_id":"MDQ6VXNlcjE0OTQ5OTYz","avatar_url":"https://avatars2.githubusercontent.com/u/14949963?v=4","gravatar_id":"","url":"https://api.github.com/users/HopefulToad","html_url":"https://github.com/HopefulToad","followers_url":"https://api.github.com/users/HopefulToad/followers","following_url":"https://api.github.com/users/HopefulToad/following{/other_user}","gists_url":"https://api.github.com/users/HopefulToad/gists{/gist_id}","starred_url":"https://api.github.com/users/HopefulToad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HopefulToad/subscriptions","organizations_url":"https://api.github.com/users/HopefulToad/orgs","repos_url":"https://api.github.com/users/HopefulToad/repos","events_url":"https://api.github.com/users/HopefulToad/events{/privacy}","received_events_url":"https://api.github.com/users/HopefulToad/received_events","type":"User","site_admin":false},"created_at":"2018-11-16T20:59:25Z","updated_at":"2018-11-16T20:59:25Z","author_association":"CONTRIBUTOR","body":"Have you tried updating your graphics drivers?\r\n\r\nTry explicitly disabling VSync, as well, by putting this line in the constructor:\r\n\r\n```\r\ngraphics.SynchronizeWithVerticalRetrace = false;\r\n```\r\n\r\nAlso, that `Debug` line in the `Draw` method is probably creating garbage since it's creating a new string each frame. That might have something to do with it."}}
{"actor":{"display_login":"HopefulToad"}}