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
5 changed files with 34 additions and 50 deletions
|
@ -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");
|
||||
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);
|
||||
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");
|
||||
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);
|
||||
if (f == null)
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace OpenTK.Platform
|
|||
|
||||
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.
|
||||
/// </summary>
|
||||
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="height">The Height of the DisplayMode in pixels.</param>
|
||||
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
|
||||
|
||||
#region --- Public Properties ---
|
||||
|
@ -139,7 +125,7 @@ namespace OpenTK.Platform
|
|||
get { return width; }
|
||||
set
|
||||
{
|
||||
if (value > 0 /* && (value < Screen[0].Width) */)
|
||||
if (value > 0)
|
||||
{
|
||||
width = value;
|
||||
}
|
||||
|
@ -215,7 +201,7 @@ namespace OpenTK.Platform
|
|||
CultureInfo.CurrentCulture,
|
||||
"{0}x{1}, {2}, {3}Hz",
|
||||
Width, Height,
|
||||
Color,
|
||||
Color.ToString(),
|
||||
RefreshRate
|
||||
);
|
||||
}
|
||||
|
|
|
@ -551,7 +551,9 @@ XF86VidModeGetGammaRampSize(
|
|||
|
||||
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)
|
||||
{
|
||||
Trace.WriteLine("Creating opengl context.");
|
||||
Trace.Indent();
|
||||
Debug.WriteLine("Creating opengl context.");
|
||||
Debug.Indent();
|
||||
|
||||
IntPtr shareHandle = shareContext != null ? shareContext.Handle : IntPtr.Zero;
|
||||
Trace.WriteLine(
|
||||
Debug.WriteLine(
|
||||
shareHandle == IntPtr.Zero ?
|
||||
"Context is not shared." :
|
||||
String.Format("Context is shared with context: {0}", shareHandle)
|
||||
);
|
||||
Trace.WriteLine(
|
||||
Debug.WriteLine(
|
||||
direct ?
|
||||
"Context is direct." :
|
||||
"Context is indirect."
|
||||
|
@ -167,11 +167,16 @@ namespace OpenTK.Platform.X11
|
|||
visual,
|
||||
shareHandle,
|
||||
direct
|
||||
);
|
||||
Trace.WriteLine(String.Format("New opengl context created. (id: {0})", x11context));
|
||||
Trace.Unindent();
|
||||
|
||||
//MakeCurrent();
|
||||
);
|
||||
if (x11context != IntPtr.Zero)
|
||||
{
|
||||
Debug.WriteLine(String.Format("New opengl context created. (id: {0})", x11context));
|
||||
Debug.Unindent();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ApplicationException("Could not create opengl context.");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -182,7 +187,7 @@ namespace OpenTK.Platform.X11
|
|||
{
|
||||
Debug.WriteLine("Creating visual.");
|
||||
Debug.Indent();
|
||||
|
||||
/*
|
||||
ColorDepth color = new ColorDepth(24);
|
||||
int depthBits = 16;
|
||||
|
||||
|
@ -201,8 +206,10 @@ namespace OpenTK.Platform.X11
|
|||
visualAttributes.Add((int)depthBits);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.NONE);
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
Debug.Print("Requesting visual: {0}... ", mode.ToString());
|
||||
|
||||
List<int> visualAttributes = new List<int>();
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.RGBA);
|
||||
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)mode.Color.Alpha);
|
||||
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.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());
|
||||
if (visual == IntPtr.Zero)
|
||||
{
|
||||
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();
|
||||
|
||||
return visualInfo;
|
||||
|
|
Loading…
Reference in a new issue