mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-02 10:50:58 +00:00
Updated ToString function for ColorDepth and DisplayMode.
Corrected two warnings in GLHelper.cs Updated X11GLContext to use the correct DisplayMode.
This commit is contained in:
parent
39a8a8d190
commit
81a26ab792
|
@ -422,7 +422,7 @@ Did you remember to copy OpenTK.OpenGL.dll.config to your binary's folder?
|
||||||
{
|
{
|
||||||
Assembly asm = Assembly.GetExecutingAssembly();//Assembly.Load("OpenTK.OpenGL");
|
Assembly asm = Assembly.GetExecutingAssembly();//Assembly.Load("OpenTK.OpenGL");
|
||||||
Type delegates_class = asm.GetType("OpenTK.OpenGL.Delegates");
|
Type delegates_class = asm.GetType("OpenTK.OpenGL.Delegates");
|
||||||
Type imports_class = asm.GetType("OpenTK.OpenGL.Imports");
|
//Type imports_class = asm.GetType("OpenTK.OpenGL.Imports");
|
||||||
|
|
||||||
FieldInfo[] v = delegates_class.GetFields(BindingFlags.Static | BindingFlags.NonPublic);
|
FieldInfo[] v = delegates_class.GetFields(BindingFlags.Static | BindingFlags.NonPublic);
|
||||||
foreach (FieldInfo f in v)
|
foreach (FieldInfo f in v)
|
||||||
|
@ -464,7 +464,7 @@ Did you remember to copy OpenTK.OpenGL.dll.config to your binary's folder?
|
||||||
{
|
{
|
||||||
Assembly asm = Assembly.Load("OpenTK.OpenGL");
|
Assembly asm = Assembly.Load("OpenTK.OpenGL");
|
||||||
Type delegates_class = asm.GetType("OpenTK.OpenGL.Delegates");
|
Type delegates_class = asm.GetType("OpenTK.OpenGL.Delegates");
|
||||||
Type imports_class = asm.GetType("OpenTK.OpenGL.Imports");
|
//Type imports_class = asm.GetType("OpenTK.OpenGL.Imports");
|
||||||
|
|
||||||
FieldInfo f = delegates_class.GetField(name);
|
FieldInfo f = delegates_class.GetField(name);
|
||||||
if (f == null)
|
if (f == null)
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace OpenTK.Platform
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return string.Format(CultureInfo.CurrentCulture, "{0}", BitsPerPixel + (IsIndexed ? " indexed" : String.Empty) + " bpp");
|
return string.Format("{0} ({1})", BitsPerPixel, (IsIndexed ? " indexed" : Red.ToString() + Green.ToString() + Blue.ToString() + Alpha.ToString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace OpenTK.Platform
|
||||||
/// Constructs a new DisplayMode with default values.
|
/// Constructs a new DisplayMode with default values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DisplayMode()
|
public DisplayMode()
|
||||||
: this(0, 0, new ColorDepth(0), 0, 0, 0, 0, false, false, false, 0.0f)
|
: this(0, 0, new ColorDepth(32), 0, 0, 0, 0, false, false, false, 0.0f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,24 +88,10 @@ namespace OpenTK.Platform
|
||||||
/// <param name="width">The Width of the DisplayMode in pixels.</param>
|
/// <param name="width">The Width of the DisplayMode in pixels.</param>
|
||||||
/// <param name="height">The Height of the DisplayMode in pixels.</param>
|
/// <param name="height">The Height of the DisplayMode in pixels.</param>
|
||||||
public DisplayMode(int width, int height)
|
public DisplayMode(int width, int height)
|
||||||
: this(width, height, new ColorDepth(0), 0, 0, 0, 0, false, false, false, 0.0f)
|
: this(width, height, new ColorDepth(32), 0, 0, 0, 0, false, false, false, 0.0f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
public DisplayMode(int width, int height, int bpp, int frequency)
|
|
||||||
: this(width, height, 0, 0, 0, 0, frequency)
|
|
||||||
{
|
|
||||||
color = new ColorDepth(bpp);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
public DisplayMode(int width, int height, int r, int g, int b, int a, int frequency)
|
|
||||||
{
|
|
||||||
size = new Size(width, height);
|
|
||||||
color = new ColorDepth(r, g, b, a);
|
|
||||||
displayFrequency = frequency;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region --- Public Properties ---
|
#region --- Public Properties ---
|
||||||
|
@ -139,7 +125,7 @@ namespace OpenTK.Platform
|
||||||
get { return width; }
|
get { return width; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value > 0 /* && (value < Screen[0].Width) */)
|
if (value > 0)
|
||||||
{
|
{
|
||||||
width = value;
|
width = value;
|
||||||
}
|
}
|
||||||
|
@ -215,7 +201,7 @@ namespace OpenTK.Platform
|
||||||
CultureInfo.CurrentCulture,
|
CultureInfo.CurrentCulture,
|
||||||
"{0}x{1}, {2}, {3}Hz",
|
"{0}x{1}, {2}, {3}Hz",
|
||||||
Width, Height,
|
Width, Height,
|
||||||
Color,
|
Color.ToString(),
|
||||||
RefreshRate
|
RefreshRate
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -551,7 +551,9 @@ XF86VidModeGetGammaRampSize(
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return base.ToString();
|
// return base.ToString();
|
||||||
|
return String.Format("VisualInfo: id ({0}), screen ({1}), depth ({2}), class ({3})",
|
||||||
|
visualid, screen, depth, @class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,16 +148,16 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
public void CreateContext(X11GLContext shareContext, bool direct)
|
public void CreateContext(X11GLContext shareContext, bool direct)
|
||||||
{
|
{
|
||||||
Trace.WriteLine("Creating opengl context.");
|
Debug.WriteLine("Creating opengl context.");
|
||||||
Trace.Indent();
|
Debug.Indent();
|
||||||
|
|
||||||
IntPtr shareHandle = shareContext != null ? shareContext.Handle : IntPtr.Zero;
|
IntPtr shareHandle = shareContext != null ? shareContext.Handle : IntPtr.Zero;
|
||||||
Trace.WriteLine(
|
Debug.WriteLine(
|
||||||
shareHandle == IntPtr.Zero ?
|
shareHandle == IntPtr.Zero ?
|
||||||
"Context is not shared." :
|
"Context is not shared." :
|
||||||
String.Format("Context is shared with context: {0}", shareHandle)
|
String.Format("Context is shared with context: {0}", shareHandle)
|
||||||
);
|
);
|
||||||
Trace.WriteLine(
|
Debug.WriteLine(
|
||||||
direct ?
|
direct ?
|
||||||
"Context is direct." :
|
"Context is direct." :
|
||||||
"Context is indirect."
|
"Context is indirect."
|
||||||
|
@ -167,11 +167,16 @@ namespace OpenTK.Platform.X11
|
||||||
visual,
|
visual,
|
||||||
shareHandle,
|
shareHandle,
|
||||||
direct
|
direct
|
||||||
);
|
);
|
||||||
Trace.WriteLine(String.Format("New opengl context created. (id: {0})", x11context));
|
if (x11context != IntPtr.Zero)
|
||||||
Trace.Unindent();
|
{
|
||||||
|
Debug.WriteLine(String.Format("New opengl context created. (id: {0})", x11context));
|
||||||
//MakeCurrent();
|
Debug.Unindent();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ApplicationException("Could not create opengl context.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -182,7 +187,7 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Creating visual.");
|
Debug.WriteLine("Creating visual.");
|
||||||
Debug.Indent();
|
Debug.Indent();
|
||||||
|
/*
|
||||||
ColorDepth color = new ColorDepth(24);
|
ColorDepth color = new ColorDepth(24);
|
||||||
int depthBits = 16;
|
int depthBits = 16;
|
||||||
|
|
||||||
|
@ -201,8 +206,10 @@ namespace OpenTK.Platform.X11
|
||||||
visualAttributes.Add((int)depthBits);
|
visualAttributes.Add((int)depthBits);
|
||||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
|
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
|
||||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.NONE);
|
visualAttributes.Add((int)Glx.Enums.GLXAttribute.NONE);
|
||||||
|
*/
|
||||||
/*
|
|
||||||
|
Debug.Print("Requesting visual: {0}... ", mode.ToString());
|
||||||
|
|
||||||
List<int> visualAttributes = new List<int>();
|
List<int> visualAttributes = new List<int>();
|
||||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.RGBA);
|
visualAttributes.Add((int)Glx.Enums.GLXAttribute.RGBA);
|
||||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.RED_SIZE);
|
visualAttributes.Add((int)Glx.Enums.GLXAttribute.RED_SIZE);
|
||||||
|
@ -214,29 +221,18 @@ 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)depthBits);
|
visualAttributes.Add((int)mode.DepthBits);
|
||||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
|
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
|
||||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.NONE);
|
visualAttributes.Add((int)Glx.Enums.GLXAttribute.NONE);
|
||||||
*/
|
|
||||||
Debug.Write(
|
|
||||||
String.Format(
|
|
||||||
"Requesting visual: {0} ({1}{2}{3}{4})... ",
|
|
||||||
mode.ToString(),
|
|
||||||
mode.Color.Red,
|
|
||||||
mode.Color.Green,
|
|
||||||
mode.Color.Blue,
|
|
||||||
mode.Color.Alpha
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, visualAttributes.ToArray());
|
visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, visualAttributes.ToArray());
|
||||||
if (visual == IntPtr.Zero)
|
if (visual == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new Exception("Requested visual not available.");
|
throw new Exception("Requested visual not available.");
|
||||||
}
|
}
|
||||||
visualInfo = (VisualInfo)Marshal.PtrToStructure(visual, typeof(VisualInfo));
|
visualInfo = (VisualInfo)Marshal.PtrToStructure(visual, typeof(VisualInfo));
|
||||||
|
Debug.Print("Got visual: {0}", visualInfo.ToString());
|
||||||
|
|
||||||
Debug.Print("done! (id: {0})", x11context);
|
|
||||||
Debug.Unindent();
|
Debug.Unindent();
|
||||||
|
|
||||||
return visualInfo;
|
return visualInfo;
|
||||||
|
|
Loading…
Reference in a new issue