Updated everything to use plain (int width, int height parameters) instead of DisplayMode.Width/.Height.
This commit is contained in:
parent
18ec1d5ad5
commit
d1f2d7b33e
7 changed files with 27 additions and 23 deletions
|
@ -201,7 +201,7 @@ namespace OpenTK
|
||||||
// Mono's implementation of Windows.Forms on X11 does not allow the context to
|
// Mono's implementation of Windows.Forms on X11 does not allow the context to
|
||||||
// have a different colordepth from the parent. To combat this, we do not set a
|
// have a different colordepth from the parent. To combat this, we do not set a
|
||||||
// specific depth for the DisplayMode - we let the driver select one instead.
|
// specific depth for the DisplayMode - we let the driver select one instead.
|
||||||
display_mode.Color = new ColorMode(0);
|
//display_mode.ColorFormat = new ColorMode(0);
|
||||||
context = new GLContext(display_mode, info);
|
context = new GLContext(display_mode, info);
|
||||||
idle = new PlatformIdle(info);
|
idle = new PlatformIdle(info);
|
||||||
}
|
}
|
||||||
|
|
|
@ -328,7 +328,7 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
glWindow.CreateWindow(mode, out glContext);
|
glWindow.CreateWindow(mode.Width, mode.Height, mode, out glContext);
|
||||||
}
|
}
|
||||||
catch (ApplicationException expt)
|
catch (ApplicationException expt)
|
||||||
{
|
{
|
||||||
|
@ -382,7 +382,7 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
// TODO: This is a hack - reslove in 0.3.15 once and for all!
|
// TODO: This is a hack - reslove in 0.3.15 once and for all!
|
||||||
// GLContext is created inside the CreateWindow call.
|
// GLContext is created inside the CreateWindow call.
|
||||||
glWindow.CreateWindow(mode, out glContext);
|
glWindow.CreateWindow(mode.Width, mode.Height, mode, out glContext);
|
||||||
this.Title = title;
|
this.Title = title;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1153,7 +1153,11 @@ namespace OpenTK
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when the GameWindow is resized. Derived classes should override the OnResize method for better performance.
|
/// Occurs when the GameWindow is resized. Derived classes should override the OnResize method for better performance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event ResizeEvent Resize;
|
public event ResizeEvent Resize
|
||||||
|
{
|
||||||
|
add { glWindow.Resize += value; }
|
||||||
|
remove { glWindow.Resize -= value; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raises the Resize event.
|
/// Raises the Resize event.
|
||||||
|
@ -1166,8 +1170,8 @@ namespace OpenTK
|
||||||
this.width = e.Width;
|
this.width = e.Width;
|
||||||
this.height = e.Height;
|
this.height = e.Height;
|
||||||
|
|
||||||
if (this.Resize != null)
|
//if (this.Resize != null)
|
||||||
this.Resize(this, e);
|
// this.Resize(this, e);
|
||||||
|
|
||||||
OnResize(e);
|
OnResize(e);
|
||||||
}
|
}
|
||||||
|
@ -1215,7 +1219,7 @@ namespace OpenTK
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
#if false // TODO: 0.3.15 (Linux support missing)
|
#if false // TODO: 0.9.2 (Linux support missing)
|
||||||
#region PointToClient
|
#region PointToClient
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace OpenTK.Platform
|
||||||
/// </summary>
|
/// </summary>
|
||||||
interface INativeGLWindow : IResizable, IDisposable
|
interface INativeGLWindow : IResizable, IDisposable
|
||||||
{
|
{
|
||||||
void CreateWindow(DisplayMode mode, out IGLContext context);
|
void CreateWindow(int width, int height, DisplayMode mode, out IGLContext context);
|
||||||
void DestroyWindow();
|
void DestroyWindow();
|
||||||
void ProcessEvents();
|
void ProcessEvents();
|
||||||
void PointToClient(ref System.Drawing.Point p);
|
void PointToClient(ref System.Drawing.Point p);
|
||||||
|
|
|
@ -334,10 +334,10 @@ namespace OpenTK.Platform.Windows
|
||||||
pixelFormat.AccumAlphaBits = (byte)accum.Alpha;
|
pixelFormat.AccumAlphaBits = (byte)accum.Alpha;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
pixelFormat.DepthBits = (byte)mode.DepthBits;
|
pixelFormat.DepthBits = (byte)mode.Depth;
|
||||||
pixelFormat.StencilBits = (byte)mode.StencilBits;
|
pixelFormat.StencilBits = (byte)mode.Stencil;
|
||||||
|
|
||||||
if (mode.DepthBits <= 0)
|
if (mode.Depth <= 0)
|
||||||
{
|
{
|
||||||
pixelFormat.Flags |= PixelFormatDescriptorFlags.DEPTH_DONTCARE;
|
pixelFormat.Flags |= PixelFormatDescriptorFlags.DEPTH_DONTCARE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,7 +275,7 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
#region public void CreateWindow(DisplayMode mode, out IGLContext context)
|
#region public void CreateWindow(DisplayMode mode, out IGLContext context)
|
||||||
|
|
||||||
public void CreateWindow(DisplayMode windowMode, out IGLContext context)
|
public void CreateWindow(int width, int height, DisplayMode windowMode, out IGLContext context)
|
||||||
{
|
{
|
||||||
Debug.Print("Creating native window with mode: {0}", windowMode.ToString());
|
Debug.Print("Creating native window with mode: {0}", windowMode.ToString());
|
||||||
Debug.Indent();
|
Debug.Indent();
|
||||||
|
@ -294,21 +294,21 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
Rectangle rect = new Rectangle();
|
Rectangle rect = new Rectangle();
|
||||||
rect.top = rect.left = 0;
|
rect.top = rect.left = 0;
|
||||||
rect.bottom = windowMode.Height;
|
rect.bottom = height;
|
||||||
rect.right = windowMode.Width;
|
rect.right = width;
|
||||||
Functions.AdjustWindowRect(ref rect, WindowStyle.OverlappedWindow, false);
|
Functions.AdjustWindowRect(ref rect, WindowStyle.OverlappedWindow, false);
|
||||||
|
|
||||||
// Not used
|
// Not used
|
||||||
Top = 0;
|
Top = 0;
|
||||||
Left = 0;
|
Left = 0;
|
||||||
Right = windowMode.Width;
|
Right = width;
|
||||||
Bottom = windowMode.Height;
|
Bottom = height;
|
||||||
// --------
|
// --------
|
||||||
|
|
||||||
top_border = -rect.top;
|
top_border = -rect.top;
|
||||||
left_border = -rect.left;
|
left_border = -rect.left;
|
||||||
bottom_border = rect.bottom - windowMode.Height;
|
bottom_border = rect.bottom - height;
|
||||||
right_border = rect.right - windowMode.Width;
|
right_border = rect.right - width;
|
||||||
|
|
||||||
cp.Width = rect.right - rect.left;
|
cp.Width = rect.right - rect.left;
|
||||||
cp.Height = rect.bottom - rect.top;
|
cp.Height = rect.bottom - rect.top;
|
||||||
|
@ -472,8 +472,8 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
public void OnResize(ResizeEventArgs e)
|
public void OnResize(ResizeEventArgs e)
|
||||||
{
|
{
|
||||||
mode.Width = e.Width;
|
this.width = e.Width;
|
||||||
mode.Height = e.Height;
|
this.height = e.Height;
|
||||||
if (this.Resize != null)
|
if (this.Resize != null)
|
||||||
this.Resize(this, e);
|
this.Resize(this, e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace OpenTK.Platform.X11
|
||||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.ALPHA_SIZE);
|
visualAttributes.Add((int)Glx.Enums.GLXAttribute.ALPHA_SIZE);
|
||||||
visualAttributes.Add((int)mode.Color.Alpha);
|
visualAttributes.Add((int)mode.Color.Alpha);
|
||||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE);
|
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE);
|
||||||
visualAttributes.Add((int)mode.DepthBits);
|
visualAttributes.Add((int)mode.Depth);
|
||||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
|
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
|
||||||
visualAttributes.Add((int)0);
|
visualAttributes.Add((int)0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -347,7 +347,7 @@ namespace OpenTK.Platform.X11
|
||||||
/// Colormap creation is currently disabled.
|
/// Colormap creation is currently disabled.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public void CreateWindow(DisplayMode mode, out IGLContext glContext)
|
public void CreateWindow(int width, int height, DisplayMode mode, out IGLContext glContext)
|
||||||
{
|
{
|
||||||
if (exists)
|
if (exists)
|
||||||
throw new ApplicationException("Render window already exists!");
|
throw new ApplicationException("Render window already exists!");
|
||||||
|
|
Loading…
Reference in a new issue