kanato's picture

Failure to initialize on Windows.

Project:The Open Toolkit library
Version:1.0-beta-3
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

On Windows in the 1.0 branch I'm getting a crash in initializing a context. This occurs in the call to
GraphicsMode.ToString, which leads to creating a NativeWindow in WinGraphicsMode.cs line 157
Then the problem occurs in WinGLNative constructor, because on the line window = new WinWindowInfo(CreateWindow(...)) because the WindowProcedure is called by CreateWindowEx and tries to set the foreground from window.WindowHandle.

Stack Trace:

   at OpenTK.Platform.Windows.WinGLNative.WindowProcedure(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
   at OpenTK.Platform.Windows.Functions.CreateWindowEx(ExtendedWindowStyle ExStyle, IntPtr ClassAtom, IntPtr WindowName, WindowStyle Style, Int32 X, Int32 Y, Int32 Width, Int32 Height, IntPtr HandleToParentWindow, IntPtr Menu, IntPtr Instance, IntPtr Param)
   at OpenTK.Platform.Windows.WinGLNative.CreateWindow(Int32 x, Int32 y, Int32 width, Int32 height, String title, GameWindowFlags options, DisplayDevice device, IntPtr parentHandle)
   at OpenTK.Platform.Windows.WinGLNative..ctor(Int32 x, Int32 y, Int32 width, Int32 height, String title, GameWindowFlags options, DisplayDevice device)
   at OpenTK.Platform.Windows.WinFactory.CreateNativeWindow(Int32 x, Int32 y, Int32 width, Int32 height, String title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
   at OpenTK.NativeWindow..ctor(Int32 x, Int32 y, Int32 width, Int32 height, String title, GameWindowFlags options, GraphicsMode mode, DisplayDevice device)
   at OpenTK.NativeWindow..ctor(Int32 width, Int32 height, String title, GameWindowFlags options, GraphicsMode mode, DisplayDevice device)
   at OpenTK.NativeWindow..ctor()
   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.get_Index()
   at OpenTK.Graphics.GraphicsMode.ToString()
   at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
   at System.String.Format(IFormatProvider provider, String format, Object[] args)
   at System.Diagnostics.Debug.Print(String format, Object[] args)
   at OpenTK.Graphics.GraphicsContext..ctor(GraphicsMode mode, IWindowInfo window, Int32 major, Int32 minor, GraphicsContextFlags flags)
   at AgateOTK.GL_DisplayControl.CreateContext() in C:\Users\Erik\Documents\devel\Games\Agate\trunk\Drivers\AgateOTK\GL_DisplayControl.cs:line 223
   at AgateOTK.GL_DisplayControl..ctor(CreateWindowParams windowParams) in C:\Users\Erik\Documents\devel\Games\Agate\trunk\Drivers\AgateOTK\GL_DisplayControl.cs:line 96
   at AgateOTK.GL_Display.CreateDisplayWindow(CreateWindowParams windowParams) in C:\Users\Erik\Documents\devel\Games\Agate\trunk\Drivers\AgateOTK\GL_Display.cs:line 97
   at AgateLib.DisplayLib.DisplayWindow..ctor(CreateWindowParams windowParams) in C:\Users\Erik\Documents\devel\Games\Agate\trunk\AgateLib\DisplayLib\DisplayWindow.cs:line 87
   at AgateLib.DisplayLib.DisplayWindow.CreateFromControl(Object control) in C:\Users\Erik\Documents\devel\Games\Agate\trunk\AgateLib\DisplayLib\DisplayWindow.cs:line 109
   at AgateOTK.GL_Display.CreateFakeWindow() in C:\Users\Erik\Documents\devel\Games\Agate\trunk\Drivers\AgateOTK\GL_Display.cs:line 274
   at AgateOTK.GL_Display.Initialize() in C:\Users\Erik\Documents\devel\Games\Agate\trunk\Drivers\AgateOTK\GL_Display.cs:line 259
   at AgateLib.DisplayLib.Display.Initialize(DisplayTypeID displayType) in C:\Users\Erik\Documents\devel\Games\Agate\trunk\AgateLib\DisplayLib\Display.cs:line 96
   at AgateLib.AgateSetup.InitializeDisplay(DisplayTypeID type) in C:\Users\Erik\Documents\devel\Games\Agate\trunk\AgateLib\AgateSetup.cs:line 199
   at AgateLib.AgateSetup.InitializeDisplay() in C:\Users\Erik\Documents\devel\Games\Agate\trunk\AgateLib\AgateSetup.cs:line 187
   at AgateLib.AgateSetup.InitializeAll() in C:\Users\Erik\Documents\devel\Games\Agate\trunk\AgateLib\AgateSetup.cs:line 162
   at AgateLib.AgateSetup.Initialize(Boolean display, Boolean audio, Boolean input) in C:\Users\Erik\Documents\devel\Games\Agate\trunk\AgateLib\AgateSetup.cs:line 154
   at Tests.DisplayTests.BasicDrawing.BasicDrawing.Main(String[] args) in C:\Users\Erik\Documents\devel\Games\Agate\trunk\Tests\DisplayTests\BasicDrawing\BasicDrawing.cs:line 88
   at Tests.frmLauncher.LaunchTest(TestInfo m) in C:\Users\Erik\Documents\devel\Games\Agate\trunk\Tests\frmLauncher.cs:line 102
   at Tests.frmLauncher.lstTests_DoubleClick(Object sender, EventArgs e) in C:\Users\Erik\Documents\devel\Games\Agate\trunk\Tests\frmLauncher.cs:line 89
   at System.Windows.Forms.Control.OnDoubleClick(EventArgs e)
   at System.Windows.Forms.ListBox.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at Tests.Launcher.Main(String[] args) in C:\Users\Erik\Documents\devel\Games\Agate\trunk\Tests\Launcher.cs:line 20
   at System.AppDomain._nExecuteAssembly(Assembly 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)
   at System.Threading.ThreadHelper.ThreadStart()

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

Status:open» fixed

Thanks, fixed in r2567.

kanato's picture

#2

Btw, this was tested on the 1.0 branch.

the Fiddler's picture

#3

Yes, I've committed the fix to the 1.0 branch and will backport it to trunk along with a number of other recent fixes.

the Fiddler's picture

#4

Version:0.9.x-dev» 1.0-beta-3
Status:fixed» closed

Closing issues fixed in opentk-1.0-beta-3.