Skip to content

SpriteBatch.End() throws OpenTK.Graphics.GraphicsErrorException: InvalidEnum #1194

Closed
dgellow opened this Issue Jan 17, 2013 · 9 comments

3 participants

@dgellow
dgellow commented Jan 17, 2013

Hi guys.
I originally posted this post here : http://stackoverflow.com/questions/14268379/spritebatch-end-throws-opentk-graphics-graphicserrorexception-invalidenum

I decided to begin game development with MonoGame but I am facing a problem.

When I try to add a sprite to the screen with a SpriteBatch object like I can read in many XNA tutorial, I get an 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 says 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

Like it's very basic stuff I don't know if I am not missing something …

I am using MonoGame version 2.5.10 from MonoDevelop under an ArchLinux installation up to date. Mono version is 2.10.8 and OpenTK version is the latest stable release (2010.10.06).

Everything work fine with Windows 7.

Hope someone can help me with this issue !

@KonajuGames
@dgellow
@dgellow
dgellow commented Jan 20, 2013

So …

Video card

[sam@Ghin ~]$ lspci | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation GF114 GeForce GTX 560

Driver

I am using the proprietary driver.
[sam@Ghin ~]$ modinfo nvidia
filename: /lib/modules/3.6.11-1-ARCH/extramodules/nvidia.ko.gz
alias: char-major-195-*
version: 310.19
supported: external
license: NVIDIA
alias: pci:v000010DEd00000E00svsdbc04sc80i00*
alias: pci:v000010DEd00000AA3svsdbc0Bsc40i00*
alias: pci:v000010DEdsvsdbc03sc02i00
alias: pci:v000010DEdsvsdbc03sc00i00
depends: i2c-core
vermagic: 3.6.6-1-ARCH SMP preempt mod_unload modversions
parm: NVreg_Mobile:int
parm: NVreg_ResmanDebugLevel:int
parm: NVreg_RmLogonRC:int
parm: NVreg_ModifyDeviceFiles:int
parm: NVreg_DeviceFileUID:int
parm: NVreg_DeviceFileGID:int
parm: NVreg_DeviceFileMode:int
parm: NVreg_RemapLimit:int
parm: NVreg_UpdateMemoryTypes:int
parm: NVreg_InitializeSystemMemoryAllocations:int
parm: NVreg_RMEdgeIntrCheck:int
parm: NVreg_UsePageAttributeTable:int
parm: NVreg_EnableMSI:int
parm: NVreg_MapRegistersEarly:int
parm: NVreg_RegisterForACPIEvents:int
parm: NVreg_CheckPCIConfigSpace:int
parm: NVreg_RegistryDwords:charp
parm: NVreg_RmMsg:charp

GL.TexEnv parameters

OpenTK.Graphics.OpenGL.GL.TexEnv (target=OpenTK.Graphics.OpenGL.TextureEnvTarget.TextureEnv, pname=OpenTK.Graphics.OpenGL.TextureEnvParameter.TextureEnvMode, param=3041) in /home/sam/Téléchargements/opentk/src/opentk/Source/OpenTK/Graphics/OpenGL/GL.cs:69308

Name            Value                        Type
target          TextureEnv                OpenTK.Graphics.OpenGL.TextureEnvTarget
pname           TextureEnvMode            OpenTK.Graphics.OpenGL.TextureEnvParameter
param           3041                         int

What's written in the output window after the launch

I'm not sure to understand what you ask for when you said :

Can you also copy the GL supported extensions that are logged to the output when the game starts.

Is this what you want ?

Loaded assembly: /home/sam/Developpement/C#/Test/FirstGame/bin/Debug/FirstGame.exe
Loaded assembly: /home/sam/Developpement/C#/Test/FirstGame/bin/Debug/MonoGame.Framework.Linux.dll [External]
Loaded assembly: /usr/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll [External]
Loaded assembly: /home/sam/Developpement/C#/Test/FirstGame/bin/Debug/OpenTK.dll [External]
Loaded assembly: /usr/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll [External]
Loaded assembly: /usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll [External]
Loaded assembly: /usr/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll [External]
Loaded assembly: /usr/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll [External]
Loaded assembly: /home/sam/Developpement/C#/Test/FirstGame/bin/Debug/Tao.Sdl.dll [External]
Number of joysticks: 0

Cheers,
dgellow

@KonajuGames
@dgellow
dgellow commented Jan 22, 2013

I'm sorry. I don't see any GL_EXT_ or GL_ARB_ in the output.

I joined a screenshot. Am I looking at the right point ?
Capture du 2013-01-22 13:49:53

Cheers,
dgellow

@KonajuGames
@dellis1972
@dgellow
@dellis1972

Glad it works

@dellis1972 dellis1972 closed this Jan 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.