coder13's picture

Access Violation Exception with GameWindow Initialization

Project:The Open Toolkit library
Version:1.1-2014-01-02
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

The Exception Occurs when i try initializing the gamewindow class. It says and error occurred when trying to read or write protected memory. it includes that its an Indication that other memory is corrupt.

here is my startup code inside main. I don't know if you might need it or not.

using (Game game = new Game(args)) {
                game.Run(float.Parse(get(args, "F") != null ? get(args, "F") : "60.0"));
                //I wrote a method called get that get's certain values that start with a '-' and a key.  E.G. -F60.0 will get the fps. 
                //it shouldn't be a problem
            }

This is the exception i get.

System.AccessViolationException was unhandled
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=OpenTK
  StackTrace:
       at OpenTK.Platform.Windows.Wgl.Imports.CreateContext(IntPtr hDc)
       at OpenTK.Platform.Windows.WinGLContext..ctor(GraphicsMode format, WinWindowInfo window, IGraphicsContext sharedContext, Int32 major, Int32 minor, GraphicsContextFlags flags)
       at OpenTK.Platform.Windows.WinFactory.CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, Boolean directRendering, Int32 major, Int32 minor, GraphicsContextFlags flags)
       at OpenTK.Graphics.GraphicsContext..ctor(GraphicsMode mode, IWindowInfo window, Int32 major, Int32 minor, GraphicsContextFlags flags)
       at OpenTK.Platform.Windows.WinGraphicsMode.SelectGraphicsModeARB(ColorFormat color, Int32 depth, Int32 stencil, Int32 samples, ColorFormat accum, Int32 buffers, Boolean stereo)
       at OpenTK.Platform.Windows.WinGraphicsMode.SelectGraphicsMode(ColorFormat color, Int32 depth, Int32 stencil, Int32 samples, ColorFormat accum, Int32 buffers, Boolean stereo)
       at OpenTK.Graphics.GraphicsMode.LazySelectGraphicsMode()
       at OpenTK.Graphics.GraphicsMode.get_Index()
       at OpenTK.Platform.Windows.WinGLContext.SetGraphicsModePFD(GraphicsMode mode, WinWindowInfo window)
       at OpenTK.Platform.Windows.WinGLContext..ctor(GraphicsMode format, WinWindowInfo window, IGraphicsContext sharedContext, Int32 major, Int32 minor, GraphicsContextFlags flags)
       at OpenTK.Platform.Windows.WinFactory.CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, Boolean directRendering, Int32 major, Int32 minor, GraphicsContextFlags flags)
       at OpenTK.Graphics.GraphicsContext..ctor(GraphicsMode mode, IWindowInfo window, Int32 major, Int32 minor, GraphicsContextFlags flags)
       at OpenTK.GameWindow..ctor(Int32 width, Int32 height, GraphicsMode mode, String title, GameWindowFlags options, DisplayDevice device, Int32 major, Int32 minor, GraphicsContextFlags flags, IGraphicsContext sharedContext)
       at OpenTK.GameWindow..ctor(Int32 width, Int32 height, GraphicsMode mode, String title, GameWindowFlags options, DisplayDevice device, Int32 major, Int32 minor, GraphicsContextFlags flags)
       at OpenTK.GameWindow..ctor(Int32 width, Int32 height, GraphicsMode mode, String title, GameWindowFlags options, DisplayDevice device)
       at OpenTK.GameWindow..ctor()
       at opentk_Tests.Game..ctor(String[] args) in C:\Users\Caleb\documents\visual studio 2010\Projects\OpenGLTests\opentk_Tests\Program.cs:line 24
       at opentk_Tests.Program.Main(String[] args) in C:\Users\Caleb\documents\visual studio 2010\Projects\OpenGLTests\opentk_Tests\Program.cs:line 143
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

#1

Nvidia and Ati made some changes to their OpenGL stack recently which may account for some GraphicsContext crashes. Please give the latest nightly build a try, there is a good chance the issue is fixed there.

the Fiddler's picture

#2

Status:open» need info
the Fiddler's picture

#3

Version:1.0-2010-10-06» 1.1-2014-01-02
Status:need info» closed

This issue should now be fixed in OpenTK 1.1 beta4.

Please file a bug report at https://github.com/opentk/opentk/issues if you can still reproduce this.