Solved context creation on windows.

This commit is contained in:
the_fiddler 2008-01-11 20:37:09 +00:00
parent caf9a991b4
commit f8ec5ffcd0

View file

@ -129,8 +129,6 @@ namespace OpenTK
CreateWindow(mode, title); CreateWindow(mode, title);
glContext = new GLContext(mode, glWindow.WindowInfo);
glContext.CreateContext();
//this.vsync = VSyncMode.Adaptive; //this.vsync = VSyncMode.Adaptive;
this.VSync = VSyncMode.On; this.VSync = VSyncMode.On;
} }
@ -214,7 +212,7 @@ namespace OpenTK
/// Returns the opengl IGLontext associated with the current GameWindow. /// Returns the opengl IGLontext associated with the current GameWindow.
/// Forces window creation. /// Forces window creation.
/// </summary> /// </summary>
public IGLContext Context public GLContext Context
{ {
get get
{ {
@ -329,7 +327,7 @@ namespace OpenTK
{ {
try try
{ {
glWindow.CreateWindow(mode); glWindow.CreateWindow(mode, Context);
} }
catch (ApplicationException expt) catch (ApplicationException expt)
{ {
@ -381,7 +379,11 @@ namespace OpenTK
{ {
if (!Exists) if (!Exists)
{ {
glWindow.CreateWindow(mode); glWindow.CreateWindow(mode, glContext);
glContext = new GLContext(mode, glWindow.WindowInfo);
(glContext as IGLContextCreationHack).SetWindowHandle(glWindow.WindowInfo.Handle);
(glContext as IGLContextCreationHack).SelectDisplayMode(mode, glWindow.WindowInfo);
glContext.CreateContext();
this.Title = title; this.Title = title;
} }
else else
@ -1278,6 +1280,7 @@ namespace OpenTK
{ {
if (glWindow != null) if (glWindow != null)
{ {
glContext.Dispose();
glWindow.Dispose(); glWindow.Dispose();
glWindow = null; glWindow = null;
} }