Changed the INativeGLWindow.CreateWindow interface to return an IGLContext instead of a GLContext.

This commit is contained in:
the_fiddler 2008-01-15 10:48:48 +00:00
parent dc151f3929
commit 50f6bd2807
4 changed files with 16 additions and 11 deletions

View file

@ -71,7 +71,7 @@ namespace OpenTK
//InputDriver input_driver;
GLContext glContext;
IGLContext glContext;
#endregion
@ -212,7 +212,7 @@ namespace OpenTK
/// Returns the opengl IGLontext associated with the current GameWindow.
/// Forces window creation.
/// </summary>
public GLContext Context
public IGLContext Context
{
get
{

View file

@ -17,7 +17,7 @@ namespace OpenTK.Platform
/// </summary>
interface INativeGLWindow : IResizable, IDisposable
{
void CreateWindow(DisplayMode mode, out GLContext context);
void CreateWindow(DisplayMode mode, out IGLContext context);
void DestroyWindow();
void ProcessEvents();
void PointToClient(ref System.Drawing.Point p);

View file

@ -277,9 +277,9 @@ namespace OpenTK.Platform.Windows
#endregion
#region public void CreateWindow(DisplayMode mode, out GLContext context)
#region public void CreateWindow(DisplayMode mode, out IGLContext context)
public void CreateWindow(DisplayMode windowMode, out GLContext context)
public void CreateWindow(DisplayMode windowMode, out IGLContext context)
{
Debug.Print("Creating native window with mode: {0}", windowMode.ToString());
Debug.Indent();
@ -336,8 +336,13 @@ namespace OpenTK.Platform.Windows
Functions.SetWindowPos(this.Handle, WindowPlacementOptions.TOP, Left, Top, cp.Width, cp.Height, SetWindowPosFlags.SHOWWINDOW);
context = new GLContext(mode, window);
context.CreateContext();
//context = new GLContext(mode, window);
//context.CreateContext();
context = new WinGLContext();
(context as IGLContextCreationHack).SetWindowHandle(window.Handle);
(context as IGLContextCreationHack).SelectDisplayMode(mode, window);
context.CreateContext(true, null);
Debug.Unindent();
}

View file

@ -334,7 +334,7 @@ namespace OpenTK.Platform.X11
#endregion
#region public void CreateWindow(DisplayMode mode, out GLContext glContext)
#region public void CreateWindow(DisplayMode mode, out IGLContext glContext)
/// <summary>
/// Opens a new render window with the given DisplayMode.
@ -347,7 +347,7 @@ namespace OpenTK.Platform.X11
/// Colormap creation is currently disabled.
/// </para>
/// </remarks>
public void CreateWindow(DisplayMode mode, out GLContext glContext)
public void CreateWindow(DisplayMode mode, out IGLContext glContext)
{
if (exists)
throw new ApplicationException("Render window already exists!");
@ -355,12 +355,12 @@ namespace OpenTK.Platform.X11
Debug.Print("Creating GameWindow with mode: {0}", mode != null ? mode.ToString() : "default");
Debug.Indent();
glContext = new GLContext(mode, window);
glContext = new X11GLContext();
(glContext as IGLContextCreationHack).SelectDisplayMode(mode, window);
if (glContext == null)
throw new ApplicationException("Could not create GLContext");
Debug.Print("Created GLContext");
window.VisualInfo = ((glContext as IGLContextInternal).Info as X11.WindowInfo).VisualInfo;
window.VisualInfo = ((X11.WindowInfo)(glContext as IGLContextInternal).Info).VisualInfo;
//window.VisualInfo = Marshal.PtrToStructure(Glx.ChooseVisual(window.Display, window.Screen,
// Create a window on this display using the visual above