J
J
Joomboosick2021-10-03 15:42:26
C++ / C#
Joomboosick, 2021-10-03 15:42:26

Why glitches instead of symbols (monogame drawtext)?

You need to sign the axes, at the moment, for an example, hello should be written with each picture, but I have this krakozyabra.
When I change the RasterizerState, the text may disappear, glitches appeared when I specified the effect in the sprite.Begin method, but without this, he simply drew in the window, and I have world coordinates

Output example

6159a47151dc8193094519.png

The code


protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin(SpriteSortMode.Texture, null, null, null, RasterizerState.CullClockwise, effect, null);
            foreach (var pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                graphics.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineList, axes, 0, axes.Length / 2);
                foreach (var timestamp in timestamps)
                {
                    MouseState mouse = Mouse.GetState();
                    var pos = timestamp.Key.ToArray();
                    graphics.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineStrip, pos, 0, timestamp.Key.Count / 2);
                    spriteBatch.DrawString(textBlock, "Hello", new Vector2(pos[0].Position.X, pos[0].Position.Y), pos[0].Color);
                    Console.WriteLine(camera.GetMouse(mouse.Position.ToVector2()));
                }
                foreach (var graph in graphs)
                {
                    if (graph.Length >= 2)
                        graphics.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineList, graph, 0, graph.Length / 2);
                    
                }
            }
            base.Draw(gameTime);
            spriteBatch.End();
        }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question