SpriteBatch.End()抛出OpenTK.Graphics.GraphicsErrorException:InvalidEnum

时间:2013-01-10 22:24:13

标签: c# linux opentk monogame

我决定用MonoGame开始游戏开发,但我遇到了一个问题。

当我尝试使用像我在许多XNA教程中读到的SpriteBatch对象一样向屏幕添加一个精灵时,我得到一个OpenTK.Graphics.GraphicsErrorException。

    protected override void Draw (GameTime gameTime)
    {
        graphics.GraphicsDevice.Clear (Color.CornflowerBlue);

        spriteBatch.Begin();
        spriteBatch.Draw(spriteTexture, position, Color.White);
        spriteBatch.End(); // <—— Exception here

        base.Draw (gameTime);
    }

Exception.Message说 InvalidEnum

OpenTK.Graphics.GraphicsErrorException: InvalidEnum
  at OpenTK.Graphics.OpenGL.ErrorHelper.CheckErrors () [0x000c0] in /home/sam/Téléchargements/opentk/src/opentk/Source/OpenTK/Graphics/OpenGL/ErrorHelper.cs:118
  at OpenTK.Graphics.OpenGL.ErrorHelper.Dispose () [0x00000] in /home/sam/Téléchargements/opentk/src/opentk/Source/OpenTK/Graphics/OpenGL/ErrorHelper.cs:129
  at OpenTK.Graphics.OpenGL.GL.TexEnv (TextureEnvTarget target, TextureEnvParameter pname, Int32 param) [0x0001e] in /home/sam/Téléchargements/opentk/src/opentk/Source/OpenTK/Graphics/OpenGL/GL.cs:69308
  at Microsoft.Xna.Framework.Graphics.SpriteBatch.End () [0x00000] in <filename unknown>:0
  at FirstGame.Game1.Draw (Microsoft.Xna.Framework.GameTime gameTime) [0x0003c] in /home/sam/Developpement/C#/Test/FirstGame/Game1.cs:82
  at Microsoft.Xna.Framework.Game.DoDraw (Microsoft.Xna.Framework.GameTime gameTime) [0x00000] in <filename unknown>:0
  at Microsoft.Xna.Framework.GameWindow.OnRenderFrame (System.Object sender, OpenTK.FrameEventArgs e) [0x00000] in <filename unknown>:0
  at OpenTK.GameWindow.OnRenderFrame (OpenTK.FrameEventArgs e) [0x0000b] in /home/sam/Téléchargements/opentk/src/opentk/Source/OpenTK/GameWindow.cs:976
  at OpenTK.GameWindow.OnRenderFrameInternal (OpenTK.FrameEventArgs e) [0x00016] in /home/sam/Téléchargements/opentk/src/opentk/Source/OpenTK/GameWindow.cs:1032
  at OpenTK.GameWindow.RaiseRenderFrame (System.Diagnostics.Stopwatch render_watch, System.Double& next_render, OpenTK.FrameEventArgs render_args) [0x00104] in /home/sam/Téléchargements/opentk/src/opentk/Source/OpenTK/GameWindow.cs:527
  at OpenTK.GameWindow.DispatchUpdateAndRenderFrame (System.Object sender, System.EventArgs e) [0x00018] in /home/sam/Téléchargements/opentk/src/opentk/Source/OpenTK/GameWindow.cs:433
  at OpenTK.GameWindow.Run (Double updates_per_second, Double frames_per_second) [0x000d5] in /home/sam/Téléchargements/opentk/src/opentk/Source/OpenTK/GameWindow.cs:411
  at OpenTK.GameWindow.Run (Double updateRate) [0x00000] in /home/sam/Téléchargements/opentk/src/opentk/Source/OpenTK/GameWindow.cs:358
  at Microsoft.Xna.Framework.GameWindow.Run (Double updateRate) [0x00000] in <filename unknown>:0
  at Microsoft.Xna.Framework.LinuxGamePlatform.RunLoop () [0x00000] in <filename unknown>:0
  at Microsoft.Xna.Framework.Game.Run (GameRunBehavior runBehavior) [0x00000] in <filename unknown>:0
  at Microsoft.Xna.Framework.Game.Run () [0x00000] in <filename unknown>:0
  at FirstGame.Program.Main () [0x0000a] in /home/sam/Developpement/C#/Test/FirstGame/Program.cs:21

就像它是非常基本的东西,我不知道我是不是错过了什么......

我在最新的ArchLinux安装下使用MonoDevelop的MonoGame 2.5.10版。 单声道版本为2.10.8,OpenTK版本是最新的稳定版本(2010.10.06)。

0 个答案:

没有答案