Synced trunk with 1.0 branch.

This commit is contained in:
the_fiddler 2009-11-16 18:45:41 +00:00
commit 86b366edf2
27 changed files with 751 additions and 327 deletions

View file

@ -7556,6 +7556,33 @@ SizedInternalFormat enum:
use PixelInternalFormat RGBA8UI
use PixelInternalFormat RGBA16UI
use PixelInternalFormat RGBA32UI
TextureTarget enum:
TEXTURE_RECTANGLE = 0x84F5 # ARB_texture_rectangle
PROXY_TEXTURE_RECTANGLE = 0x84F7 # ARB_texture_rectangle
GetPName enum:
TEXTURE_BINDING_RECTANGLE = 0x84F6 # ARB_texture_rectangle
MAX_RECTANGLE_TEXTURE_SIZE = 0x84F8 # ARB_texture_rectangle
ActiveUniformType enum:
SAMPLER_2D_RECT = 0x8B63 # ARB_shader_objects + ARB_texture_rectangle
SAMPLER_2D_RECT_SHADOW = 0x8B64 # ARB_shader_objects + ARB_texture_rectangle
SAMPLER_BUFFER = 0x8DC2 # EXT_gpu_shader4 + ARB_texture_buffer_object
INT_SAMPLER_2D_RECT = 0x8DCD # EXT_gpu_shader4 + ARB_texture_rectangle
INT_SAMPLER_BUFFER = 0x8DD0 # EXT_gpu_shader4 + ARB_texture_buffer_object
UNSIGNED_INT_SAMPLER_2D_RECT = 0x8DD5 # EXT_gpu_shader4 + ARB_texture_rectangle
UNSIGNED_INT_SAMPLER_BUFFER = 0x8DD8 # EXT_gpu_shader4 + ARB_texture_buffer_object
ActiveUniformBlockParameter enum:
use ARB_uniform_buffer_object UNIFORM_BLOCK_BINDING
use ARB_uniform_buffer_object UNIFORM_BLOCK_DATA_SIZE
use ARB_uniform_buffer_object UNIFORM_BLOCK_NAME_LENGTH
use ARB_uniform_buffer_object UNIFORM_BLOCK_ACTIVE_UNIFORMS
use ARB_uniform_buffer_object UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES
use ARB_uniform_buffer_object UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER
use ARB_uniform_buffer_object UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER
# Non-core
@ -7721,7 +7748,11 @@ BufferPointerNameARB enum:
GenerateMipmapTarget enum:
use TextureTarget TEXTURE_1D
use TextureTarget TEXTURE_1D_ARRAY
use TextureTarget TEXTURE_2D
use TextureTarget TEXTURE_2D_ARRAY
use TextureTarget TEXTURE_2D_MULTISAMPLE
use TextureTarget TEXTURE_2D_MULTISAMPLE_ARRAY
use TextureTarget TEXTURE_3D
use TextureTarget TEXTURE_CUBE_MAP
@ -7839,7 +7870,9 @@ GetTextureParameter enum:
TextureTarget enum:
TEXTURE_2D_MULTISAMPLE = 0x9100
PROXY_TEXTURE_2D_MULTISAMPLE = 0x9101
TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9102
PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9103
ActiveUniformType enum:
SAMPLER_2D_MULTISAMPLE = 0x9108
@ -7900,12 +7933,14 @@ GetPName enum:
# ARB_vertex_array_bgra tokens
# http://www.opengl.org/registry/specs/ARB/vertex_array_bgra.txt
# The following tokens are incorrect. They are valid for the <size>
# parameteter, not the <type> parameter - but <size> is not an enum!
# (Maybe something changed between the ARB spec and its core version?)
#ColorPointerType enum:
# BGRA = 0x80E1
ColorPointerType enum:
BGRA = 0x80E1
VertexAttribPointerType enum:
BGRA = 0x80E1
#VertexAttribPointerType enum:
# BGRA = 0x80E1
# ARB_seamless_cube_map tokens
# http://www.opengl.org/registry/specs/ARB/seamless_cube_map.txt
@ -7929,4 +7964,15 @@ GetPName enum:
# ARB_draw_elements_base_vertex tokens
# http://www.opengl.org/registry/specs/ARB/draw_elements_base_vertex.txt
# VertexAttribIPointerType (see OpenGL 3.2 reference card)
# Note: the underscore is there to avoid changing IPointer to Ipointer.
VertexAttribI_PointerType enum:
use DataType BYTE
use DataType UNSIGNED_BYTE
use DataType SHORT
use DataType UNSIGNED_SHORT
use DataType INT
use DataType UNSIGNED_INT
# End (don't remove, or the last token may be removed!)

View file

@ -247,7 +247,7 @@
</function>
<function name="VertexAttribIPointer" extension="Core">
<param name="type"><type>VertexAttribParameter</type></param>
<param name="type"><type>VertexAttribIPointerType</type></param>
</function>
<function name="BeginConditionalRender" extension="Core">
@ -269,6 +269,10 @@
<param name="internalformat"><type>SizedInternalFormat</type></param>
</function>
<function name="GetActiveUniformBlock" extension="Core">
<param name="pname"><type>ActiveUniformBlockParameter</type></param>
</function>
<!-- Version 3.2 -->
<function name="TexImage2DMultisample" extension="Core">

View file

@ -32,6 +32,7 @@ using System.Drawing.Text;
using System.Reflection;
using System.Windows.Forms;
using OpenTK.Examples.Properties;
using System.Threading;
namespace Examples
{
@ -333,7 +334,11 @@ namespace Examples
}
Trace.WriteLine(String.Format("Launching sample: \"{0}\"", e.Attribute.Title));
Trace.WriteLine(String.Empty);
main.Invoke(null, null);
Thread thread = new Thread((ThreadStart)delegate { main.Invoke(null, null); });
thread.IsBackground = true;
thread.Start();
thread.Join();
}
catch (TargetInvocationException expt)
{

View file

@ -30,12 +30,6 @@
{
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.SupportedColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.NameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.CategoryColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Version = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ExtensionColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Entry = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.LabelVendor = new System.Windows.Forms.Label();
this.LabelRenderer = new System.Windows.Forms.Label();
this.LabelVersion = new System.Windows.Forms.Label();
@ -44,6 +38,12 @@
this.TextBoxVersion = new System.Windows.Forms.TextBox();
this.LabelSupport = new System.Windows.Forms.Label();
this.TextBoxSupport = new System.Windows.Forms.TextBox();
this.SupportedColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.NameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.CategoryColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Version = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ExtensionColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.UnmanagedName = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
@ -67,55 +67,13 @@
this.CategoryColumn,
this.Version,
this.ExtensionColumn,
this.Entry});
this.UnmanagedName});
this.dataGridView1.Location = new System.Drawing.Point(0, 110);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.Size = new System.Drawing.Size(939, 397);
this.dataGridView1.TabIndex = 1;
//
// SupportedColumn
//
this.SupportedColumn.HeaderText = "";
this.SupportedColumn.Name = "SupportedColumn";
this.SupportedColumn.ReadOnly = true;
this.SupportedColumn.Width = 24;
//
// NameColumn
//
this.NameColumn.HeaderText = "Name";
this.NameColumn.Name = "NameColumn";
this.NameColumn.ReadOnly = true;
this.NameColumn.Width = 852;
//
// CategoryColumn
//
this.CategoryColumn.HeaderText = "Category";
this.CategoryColumn.Name = "CategoryColumn";
this.CategoryColumn.ReadOnly = true;
this.CategoryColumn.Width = 5;
//
// Version
//
this.Version.HeaderText = "Introduced";
this.Version.Name = "Version";
this.Version.ReadOnly = true;
this.Version.Width = 5;
//
// ExtensionColumn
//
this.ExtensionColumn.HeaderText = "Extension";
this.ExtensionColumn.Name = "ExtensionColumn";
this.ExtensionColumn.ReadOnly = true;
this.ExtensionColumn.Width = 5;
//
// Entry
//
this.Entry.HeaderText = "Entry";
this.Entry.Name = "Entry";
this.Entry.ReadOnly = true;
this.Entry.Width = 5;
//
// LabelVendor
//
this.LabelVendor.AutoSize = true;
@ -192,6 +150,48 @@
this.TextBoxSupport.Size = new System.Drawing.Size(856, 20);
this.TextBoxSupport.TabIndex = 9;
//
// SupportedColumn
//
this.SupportedColumn.HeaderText = "";
this.SupportedColumn.Name = "SupportedColumn";
this.SupportedColumn.ReadOnly = true;
this.SupportedColumn.Width = 24;
//
// NameColumn
//
this.NameColumn.HeaderText = "Name";
this.NameColumn.Name = "NameColumn";
this.NameColumn.ReadOnly = true;
this.NameColumn.Width = 852;
//
// CategoryColumn
//
this.CategoryColumn.HeaderText = "Category";
this.CategoryColumn.Name = "CategoryColumn";
this.CategoryColumn.ReadOnly = true;
this.CategoryColumn.Width = 5;
//
// Version
//
this.Version.HeaderText = "Introduced";
this.Version.Name = "Version";
this.Version.ReadOnly = true;
this.Version.Width = 5;
//
// ExtensionColumn
//
this.ExtensionColumn.HeaderText = "Extension";
this.ExtensionColumn.Name = "ExtensionColumn";
this.ExtensionColumn.ReadOnly = true;
this.ExtensionColumn.Width = 5;
//
// UnmanagedName
//
this.UnmanagedName.HeaderText = "Unmanaged Name";
this.UnmanagedName.Name = "UnmanagedName";
this.UnmanagedName.ReadOnly = true;
this.UnmanagedName.Width = 5;
//
// Extensions
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -231,6 +231,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn CategoryColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn Version;
private System.Windows.Forms.DataGridViewTextBoxColumn ExtensionColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn Entry;
private System.Windows.Forms.DataGridViewTextBoxColumn UnmanagedName;
}
}

View file

@ -55,9 +55,15 @@ namespace Examples.WinForms
{
Application.Idle -= StartAsync;
// Create a context in order to load all GL methods (GL.LoadAll() is called automatically.)
using (GLControl control = new GLControl(GraphicsMode.Default, 3, 0, GraphicsContextFlags.Default))
// Create a context to load all GL entry points.
// The loading part is handled automatically by OpenTK.
using (INativeWindow window = new OpenTK.NativeWindow())
using (IGraphicsContext context = new GraphicsContext(GraphicsMode.Default, window.WindowInfo, 3, 0, GraphicsContextFlags.Default))
{
window.ProcessEvents();
context.MakeCurrent(window.WindowInfo);
(context as IGraphicsContextInternal).LoadAll();
TextBoxVendor.Text = GL.GetString(StringName.Vendor);
TextBoxRenderer.Text = GL.GetString(StringName.Renderer);
TextBoxVersion.Text = GL.GetString(StringName.Version);
@ -73,11 +79,14 @@ namespace Examples.WinForms
foreach (Function f in LoadFunctionsFromType(typeof(GL)))
{
FieldInfo @delegate = delegates.GetField(f.EntryPoint,
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
// Only show a function as supported when all relevant overloads are supported.
if (!functions.ContainsKey(f))
functions.Add(f, (bool)delegates.GetField(f.EntryPoint).GetValue(null));
functions.Add(f, @delegate != null && @delegate.GetValue(null) != null);
else
functions[f] &= (bool)delegates.GetField(f.EntryPoint).GetValue(null);
functions[f] &= @delegate != null && @delegate.GetValue(null) != null;
}
// Count supported functions using the delegates directly.

View file

@ -188,23 +188,23 @@ namespace Examples.Tests
ControlLogMouseWheel ControlLogMouseWheelChanges =
delegate(GameWindow input_window, InputLogger control, object sender, MouseWheelEventArgs e)
{
control.MouseWheelText.Text = e.Value.ToString();
control.MouseWheelText.Text = e.ValuePrecise.ToString("F2");
};
#endregion
#region Keyboards
delegate void ControlLogKeyboard(GameWindow input_window, InputLogger control, OpenTK.Input.KeyboardDevice sender, Key key);
delegate void ControlLogKeyboard(GameWindow input_window, InputLogger control, OpenTK.Input.KeyboardDevice sender, KeyboardKeyEventArgs e);
ControlLogKeyboard ControlLogKeyboardDown =
delegate(GameWindow input_window, InputLogger control, KeyboardDevice sender, Key key)
delegate(GameWindow input_window, InputLogger control, KeyboardDevice sender, KeyboardKeyEventArgs e)
{
control.keyboardListBoxes[sender.DeviceID].Items.Add(key);
control.keyboardListBoxes[sender.DeviceID].Items.Add(e.Key);
};
ControlLogKeyboard ControlLogKeyboardUp =
delegate(GameWindow input_window, InputLogger control, KeyboardDevice sender, Key key)
delegate(GameWindow input_window, InputLogger control, KeyboardDevice sender, KeyboardKeyEventArgs e)
{
control.keyboardListBoxes[sender.DeviceID].Items.Remove(key);
control.keyboardListBoxes[sender.DeviceID].Items.Remove(e.Key);
};
#endregion

View file

@ -1,4 +1,4 @@
#region License
#region License
//
// The Open Toolkit Library License
//
@ -43,11 +43,12 @@ namespace OpenTK
/// A blittable value type is a struct that only references other value types recursively,
/// which allows it to be passed to unmanaged code directly.
/// </remarks>
public static class BlittableValueType<T> where T : struct
public static class BlittableValueType<T>
{
#region Fields
static readonly Type Type;
static readonly int stride;
#endregion
@ -56,6 +57,12 @@ namespace OpenTK
static BlittableValueType()
{
Type = typeof(T);
if (Type.IsValueType)
{
// Does this support generic types? On Mono 2.4.3 it does
// http://msdn.microsoft.com/en-us/library/5s4920fa.aspx
stride = Marshal.SizeOf(typeof(T));
}
}
#endregion
@ -65,7 +72,10 @@ namespace OpenTK
/// <summary>
/// Gets the size of the type in bytes.
/// </summary>
public static readonly int Stride = Marshal.SizeOf(typeof(T));
/// <remarks>
/// This property returns 0 for non-blittable types.
/// </remarks>
public static int Stride { get { return stride; } }
#region Check
@ -103,6 +113,9 @@ namespace OpenTK
if (type.IsPrimitive)
return true;
if (!type.IsValueType)
return false;
FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
Debug.Indent();
foreach (FieldInfo field in fields)
@ -151,7 +164,7 @@ namespace OpenTK
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
public static bool Check<T>(T type) where T : struct
public static bool Check<T>(T type)
{
return BlittableValueType<T>.Check();
}
@ -160,7 +173,7 @@ namespace OpenTK
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
public static bool Check<T>(T[] type) where T : struct
public static bool Check<T>(T[] type)
{
return BlittableValueType<T>.Check();
}
@ -169,7 +182,7 @@ namespace OpenTK
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
public static bool Check<T>(T[,] type) where T : struct
public static bool Check<T>(T[,] type)
{
return BlittableValueType<T>.Check();
}
@ -178,7 +191,7 @@ namespace OpenTK
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
public static bool Check<T>(T[, ,] type) where T : struct
public static bool Check<T>(T[, ,] type)
{
return BlittableValueType<T>.Check();
}
@ -188,14 +201,14 @@ namespace OpenTK
/// </summary>
/// <param name="type">An instance of the type to check.</param>
[CLSCompliant(false)]
public static bool Check<T>(T[][] type) where T : struct
public static bool Check<T>(T[][] type)
{
return BlittableValueType<T>.Check();
}
#endregion
#region From
#region StrideOf
/// <summary>
/// Returns the size of the specified value type in bytes.
@ -205,7 +218,6 @@ namespace OpenTK
/// <returns>An integer, specifying the size of the type in bytes.</returns>
/// <exception cref="System.ArgumentException">Occurs when type is not blittable.</exception>
public static int StrideOf<T>(T type)
where T : struct
{
if (!Check(type))
throw new ArgumentException("type");
@ -221,7 +233,6 @@ namespace OpenTK
/// <returns>An integer, specifying the size of the type in bytes.</returns>
/// <exception cref="System.ArgumentException">Occurs when type is not blittable.</exception>
public static int StrideOf<T>(T[] type)
where T : struct
{
if (!Check(type))
throw new ArgumentException("type");
@ -237,7 +248,6 @@ namespace OpenTK
/// <returns>An integer, specifying the size of the type in bytes.</returns>
/// <exception cref="System.ArgumentException">Occurs when type is not blittable.</exception>
public static int StrideOf<T>(T[,] type)
where T : struct
{
if (!Check(type))
throw new ArgumentException("type");
@ -253,7 +263,6 @@ namespace OpenTK
/// <returns>An integer, specifying the size of the type in bytes.</returns>
/// <exception cref="System.ArgumentException">Occurs when type is not blittable.</exception>
public static int StrideOf<T>(T[, ,] type)
where T : struct
{
if (!Check(type))
throw new ArgumentException("type");

View file

@ -53,25 +53,26 @@ namespace OpenTK
else if (System.Environment.OSVersion.Platform == PlatformID.Unix ||
System.Environment.OSVersion.Platform == (PlatformID)4)
{
// Distinguish between Unix and Mac OS X kernels.
switch (DetectUnixKernel())
// Distinguish between Linux, Mac OS X and other Unix operating systems.
string kernel_name = DetectUnixKernel();
switch (kernel_name)
{
case "Unix":
runningOnUnix = true;
break;
case "Linux":
runningOnLinux = runningOnUnix = true;
break;
case "Darwin":
runningOnMacOS = runningOnUnix = true;
break;
case null:
case "":
throw new PlatformNotSupportedException(
"Unknown platform. Please file a bug report at http://www.opentk.com/node/add/project-issue/opentk");
default:
throw new PlatformNotSupportedException(
DetectUnixKernel() + ": Unknown Unix platform. Please report this error at http://www.opentk.com.");
case "Linux":
runningOnLinux = runningOnUnix = true;
break;
case "Darwin":
runningOnMacOS = runningOnUnix = true;
break;
default:
runningOnUnix = true;
break;
}
}
else
@ -178,7 +179,7 @@ namespace OpenTK
}
/// <summary>
/// Detects the unix kernel by p/invoking the uname call in libc.
/// Detects the unix kernel by p/invoking uname (libc).
/// </summary>
/// <returns></returns>
private static string DetectUnixKernel()

View file

@ -41812,13 +41812,13 @@ namespace OpenTK.Graphics.OpenGL
[System.CLSCompliant(false)]
[AutoGenerated(Category = "ArbUniformBufferObject", Version = "2.0", EntryPoint = "glGetActiveUniformBlockiv")]
public static
unsafe void GetActiveUniformBlock(Int32 program, Int32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ArbUniformBufferObject pname, [OutAttribute] Int32* @params)
unsafe void GetActiveUniformBlock(Int32 program, Int32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter pname, [OutAttribute] Int32* @params)
{
#if DEBUG
using (new ErrorHelper(GraphicsContext.CurrentContext))
{
#endif
Delegates.glGetActiveUniformBlockiv((UInt32)program, (UInt32)uniformBlockIndex, (OpenTK.Graphics.OpenGL.ArbUniformBufferObject)pname, (Int32*)@params);
Delegates.glGetActiveUniformBlockiv((UInt32)program, (UInt32)uniformBlockIndex, (OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter)pname, (Int32*)@params);
#if DEBUG
}
#endif
@ -41826,7 +41826,7 @@ namespace OpenTK.Graphics.OpenGL
[AutoGenerated(Category = "ArbUniformBufferObject", Version = "2.0", EntryPoint = "glGetActiveUniformBlockiv")]
public static
void GetActiveUniformBlock(Int32 program, Int32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ArbUniformBufferObject pname, [OutAttribute] Int32[] @params)
void GetActiveUniformBlock(Int32 program, Int32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter pname, [OutAttribute] Int32[] @params)
{
#if DEBUG
using (new ErrorHelper(GraphicsContext.CurrentContext))
@ -41836,7 +41836,7 @@ namespace OpenTK.Graphics.OpenGL
{
fixed (Int32* @params_ptr = @params)
{
Delegates.glGetActiveUniformBlockiv((UInt32)program, (UInt32)uniformBlockIndex, (OpenTK.Graphics.OpenGL.ArbUniformBufferObject)pname, (Int32*)@params_ptr);
Delegates.glGetActiveUniformBlockiv((UInt32)program, (UInt32)uniformBlockIndex, (OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter)pname, (Int32*)@params_ptr);
}
}
#if DEBUG
@ -41846,7 +41846,7 @@ namespace OpenTK.Graphics.OpenGL
[AutoGenerated(Category = "ArbUniformBufferObject", Version = "2.0", EntryPoint = "glGetActiveUniformBlockiv")]
public static
void GetActiveUniformBlock(Int32 program, Int32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ArbUniformBufferObject pname, [OutAttribute] out Int32 @params)
void GetActiveUniformBlock(Int32 program, Int32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter pname, [OutAttribute] out Int32 @params)
{
#if DEBUG
using (new ErrorHelper(GraphicsContext.CurrentContext))
@ -41856,7 +41856,7 @@ namespace OpenTK.Graphics.OpenGL
{
fixed (Int32* @params_ptr = &@params)
{
Delegates.glGetActiveUniformBlockiv((UInt32)program, (UInt32)uniformBlockIndex, (OpenTK.Graphics.OpenGL.ArbUniformBufferObject)pname, (Int32*)@params_ptr);
Delegates.glGetActiveUniformBlockiv((UInt32)program, (UInt32)uniformBlockIndex, (OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter)pname, (Int32*)@params_ptr);
@params = *@params_ptr;
}
}
@ -41868,13 +41868,13 @@ namespace OpenTK.Graphics.OpenGL
[System.CLSCompliant(false)]
[AutoGenerated(Category = "ArbUniformBufferObject", Version = "2.0", EntryPoint = "glGetActiveUniformBlockiv")]
public static
unsafe void GetActiveUniformBlock(UInt32 program, UInt32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ArbUniformBufferObject pname, [OutAttribute] Int32* @params)
unsafe void GetActiveUniformBlock(UInt32 program, UInt32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter pname, [OutAttribute] Int32* @params)
{
#if DEBUG
using (new ErrorHelper(GraphicsContext.CurrentContext))
{
#endif
Delegates.glGetActiveUniformBlockiv((UInt32)program, (UInt32)uniformBlockIndex, (OpenTK.Graphics.OpenGL.ArbUniformBufferObject)pname, (Int32*)@params);
Delegates.glGetActiveUniformBlockiv((UInt32)program, (UInt32)uniformBlockIndex, (OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter)pname, (Int32*)@params);
#if DEBUG
}
#endif
@ -41883,7 +41883,7 @@ namespace OpenTK.Graphics.OpenGL
[System.CLSCompliant(false)]
[AutoGenerated(Category = "ArbUniformBufferObject", Version = "2.0", EntryPoint = "glGetActiveUniformBlockiv")]
public static
void GetActiveUniformBlock(UInt32 program, UInt32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ArbUniformBufferObject pname, [OutAttribute] Int32[] @params)
void GetActiveUniformBlock(UInt32 program, UInt32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter pname, [OutAttribute] Int32[] @params)
{
#if DEBUG
using (new ErrorHelper(GraphicsContext.CurrentContext))
@ -41893,7 +41893,7 @@ namespace OpenTK.Graphics.OpenGL
{
fixed (Int32* @params_ptr = @params)
{
Delegates.glGetActiveUniformBlockiv((UInt32)program, (UInt32)uniformBlockIndex, (OpenTK.Graphics.OpenGL.ArbUniformBufferObject)pname, (Int32*)@params_ptr);
Delegates.glGetActiveUniformBlockiv((UInt32)program, (UInt32)uniformBlockIndex, (OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter)pname, (Int32*)@params_ptr);
}
}
#if DEBUG
@ -41904,7 +41904,7 @@ namespace OpenTK.Graphics.OpenGL
[System.CLSCompliant(false)]
[AutoGenerated(Category = "ArbUniformBufferObject", Version = "2.0", EntryPoint = "glGetActiveUniformBlockiv")]
public static
void GetActiveUniformBlock(UInt32 program, UInt32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ArbUniformBufferObject pname, [OutAttribute] out Int32 @params)
void GetActiveUniformBlock(UInt32 program, UInt32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter pname, [OutAttribute] out Int32 @params)
{
#if DEBUG
using (new ErrorHelper(GraphicsContext.CurrentContext))
@ -41914,7 +41914,7 @@ namespace OpenTK.Graphics.OpenGL
{
fixed (Int32* @params_ptr = &@params)
{
Delegates.glGetActiveUniformBlockiv((UInt32)program, (UInt32)uniformBlockIndex, (OpenTK.Graphics.OpenGL.ArbUniformBufferObject)pname, (Int32*)@params_ptr);
Delegates.glGetActiveUniformBlockiv((UInt32)program, (UInt32)uniformBlockIndex, (OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter)pname, (Int32*)@params_ptr);
@params = *@params_ptr;
}
}
@ -80549,7 +80549,7 @@ namespace OpenTK.Graphics.OpenGL
[AutoGenerated(Category = "Version30", Version = "3.0", EntryPoint = "glVertexAttribIPointer")]
public static
void VertexAttribIPointer<T4>(Int32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribParameter type, Int32 stride, [InAttribute, OutAttribute] ref T4 pointer)
void VertexAttribIPointer<T4>(Int32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribIPointerType type, Int32 stride, [InAttribute, OutAttribute] ref T4 pointer)
where T4 : struct
{
#if DEBUG
@ -80559,7 +80559,7 @@ namespace OpenTK.Graphics.OpenGL
GCHandle pointer_ptr = GCHandle.Alloc(pointer, GCHandleType.Pinned);
try
{
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribParameter)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribIPointerType)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
pointer = (T4)pointer_ptr.Target;
}
finally
@ -80573,7 +80573,7 @@ namespace OpenTK.Graphics.OpenGL
[AutoGenerated(Category = "Version30", Version = "3.0", EntryPoint = "glVertexAttribIPointer")]
public static
void VertexAttribIPointer<T4>(Int32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribParameter type, Int32 stride, [InAttribute, OutAttribute] T4[,,] pointer)
void VertexAttribIPointer<T4>(Int32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribIPointerType type, Int32 stride, [InAttribute, OutAttribute] T4[,,] pointer)
where T4 : struct
{
#if DEBUG
@ -80583,7 +80583,7 @@ namespace OpenTK.Graphics.OpenGL
GCHandle pointer_ptr = GCHandle.Alloc(pointer, GCHandleType.Pinned);
try
{
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribParameter)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribIPointerType)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
}
finally
{
@ -80596,7 +80596,7 @@ namespace OpenTK.Graphics.OpenGL
[AutoGenerated(Category = "Version30", Version = "3.0", EntryPoint = "glVertexAttribIPointer")]
public static
void VertexAttribIPointer<T4>(Int32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribParameter type, Int32 stride, [InAttribute, OutAttribute] T4[,] pointer)
void VertexAttribIPointer<T4>(Int32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribIPointerType type, Int32 stride, [InAttribute, OutAttribute] T4[,] pointer)
where T4 : struct
{
#if DEBUG
@ -80606,7 +80606,7 @@ namespace OpenTK.Graphics.OpenGL
GCHandle pointer_ptr = GCHandle.Alloc(pointer, GCHandleType.Pinned);
try
{
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribParameter)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribIPointerType)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
}
finally
{
@ -80619,7 +80619,7 @@ namespace OpenTK.Graphics.OpenGL
[AutoGenerated(Category = "Version30", Version = "3.0", EntryPoint = "glVertexAttribIPointer")]
public static
void VertexAttribIPointer<T4>(Int32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribParameter type, Int32 stride, [InAttribute, OutAttribute] T4[] pointer)
void VertexAttribIPointer<T4>(Int32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribIPointerType type, Int32 stride, [InAttribute, OutAttribute] T4[] pointer)
where T4 : struct
{
#if DEBUG
@ -80629,7 +80629,7 @@ namespace OpenTK.Graphics.OpenGL
GCHandle pointer_ptr = GCHandle.Alloc(pointer, GCHandleType.Pinned);
try
{
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribParameter)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribIPointerType)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
}
finally
{
@ -80642,13 +80642,13 @@ namespace OpenTK.Graphics.OpenGL
[AutoGenerated(Category = "Version30", Version = "3.0", EntryPoint = "glVertexAttribIPointer")]
public static
void VertexAttribIPointer(Int32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribParameter type, Int32 stride, IntPtr pointer)
void VertexAttribIPointer(Int32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribIPointerType type, Int32 stride, IntPtr pointer)
{
#if DEBUG
using (new ErrorHelper(GraphicsContext.CurrentContext))
{
#endif
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribParameter)type, (Int32)stride, (IntPtr)pointer);
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribIPointerType)type, (Int32)stride, (IntPtr)pointer);
#if DEBUG
}
#endif
@ -80657,7 +80657,7 @@ namespace OpenTK.Graphics.OpenGL
[System.CLSCompliant(false)]
[AutoGenerated(Category = "Version30", Version = "3.0", EntryPoint = "glVertexAttribIPointer")]
public static
void VertexAttribIPointer<T4>(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribParameter type, Int32 stride, [InAttribute, OutAttribute] ref T4 pointer)
void VertexAttribIPointer<T4>(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribIPointerType type, Int32 stride, [InAttribute, OutAttribute] ref T4 pointer)
where T4 : struct
{
#if DEBUG
@ -80667,7 +80667,7 @@ namespace OpenTK.Graphics.OpenGL
GCHandle pointer_ptr = GCHandle.Alloc(pointer, GCHandleType.Pinned);
try
{
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribParameter)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribIPointerType)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
pointer = (T4)pointer_ptr.Target;
}
finally
@ -80682,7 +80682,7 @@ namespace OpenTK.Graphics.OpenGL
[System.CLSCompliant(false)]
[AutoGenerated(Category = "Version30", Version = "3.0", EntryPoint = "glVertexAttribIPointer")]
public static
void VertexAttribIPointer<T4>(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribParameter type, Int32 stride, [InAttribute, OutAttribute] T4[,,] pointer)
void VertexAttribIPointer<T4>(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribIPointerType type, Int32 stride, [InAttribute, OutAttribute] T4[,,] pointer)
where T4 : struct
{
#if DEBUG
@ -80692,7 +80692,7 @@ namespace OpenTK.Graphics.OpenGL
GCHandle pointer_ptr = GCHandle.Alloc(pointer, GCHandleType.Pinned);
try
{
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribParameter)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribIPointerType)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
}
finally
{
@ -80706,7 +80706,7 @@ namespace OpenTK.Graphics.OpenGL
[System.CLSCompliant(false)]
[AutoGenerated(Category = "Version30", Version = "3.0", EntryPoint = "glVertexAttribIPointer")]
public static
void VertexAttribIPointer<T4>(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribParameter type, Int32 stride, [InAttribute, OutAttribute] T4[,] pointer)
void VertexAttribIPointer<T4>(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribIPointerType type, Int32 stride, [InAttribute, OutAttribute] T4[,] pointer)
where T4 : struct
{
#if DEBUG
@ -80716,7 +80716,7 @@ namespace OpenTK.Graphics.OpenGL
GCHandle pointer_ptr = GCHandle.Alloc(pointer, GCHandleType.Pinned);
try
{
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribParameter)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribIPointerType)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
}
finally
{
@ -80730,7 +80730,7 @@ namespace OpenTK.Graphics.OpenGL
[System.CLSCompliant(false)]
[AutoGenerated(Category = "Version30", Version = "3.0", EntryPoint = "glVertexAttribIPointer")]
public static
void VertexAttribIPointer<T4>(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribParameter type, Int32 stride, [InAttribute, OutAttribute] T4[] pointer)
void VertexAttribIPointer<T4>(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribIPointerType type, Int32 stride, [InAttribute, OutAttribute] T4[] pointer)
where T4 : struct
{
#if DEBUG
@ -80740,7 +80740,7 @@ namespace OpenTK.Graphics.OpenGL
GCHandle pointer_ptr = GCHandle.Alloc(pointer, GCHandleType.Pinned);
try
{
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribParameter)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribIPointerType)type, (Int32)stride, (IntPtr)pointer_ptr.AddrOfPinnedObject());
}
finally
{
@ -80754,13 +80754,13 @@ namespace OpenTK.Graphics.OpenGL
[System.CLSCompliant(false)]
[AutoGenerated(Category = "Version30", Version = "3.0", EntryPoint = "glVertexAttribIPointer")]
public static
void VertexAttribIPointer(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribParameter type, Int32 stride, IntPtr pointer)
void VertexAttribIPointer(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribIPointerType type, Int32 stride, IntPtr pointer)
{
#if DEBUG
using (new ErrorHelper(GraphicsContext.CurrentContext))
{
#endif
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribParameter)type, (Int32)stride, (IntPtr)pointer);
Delegates.glVertexAttribIPointer((UInt32)index, (Int32)size, (OpenTK.Graphics.OpenGL.VertexAttribIPointerType)type, (Int32)stride, (IntPtr)pointer);
#if DEBUG
}
#endif

View file

@ -1526,7 +1526,7 @@ namespace OpenTK.Graphics.OpenGL
internal extern static unsafe void GetActiveUniformARB(UInt32 programObj, UInt32 index, Int32 maxLength, [OutAttribute] Int32* length, [OutAttribute] Int32* size, [OutAttribute] OpenTK.Graphics.OpenGL.ArbShaderObjects* type, [OutAttribute] StringBuilder name);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glGetActiveUniformBlockiv", ExactSpelling = true)]
internal extern static unsafe void GetActiveUniformBlockiv(UInt32 program, UInt32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ArbUniformBufferObject pname, [OutAttribute] Int32* @params);
internal extern static unsafe void GetActiveUniformBlockiv(UInt32 program, UInt32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter pname, [OutAttribute] Int32* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glGetActiveUniformBlockName", ExactSpelling = true)]
internal extern static unsafe void GetActiveUniformBlockName(UInt32 program, UInt32 uniformBlockIndex, Int32 bufSize, [OutAttribute] Int32* length, [OutAttribute] StringBuilder uniformBlockName);
@ -5339,7 +5339,7 @@ namespace OpenTK.Graphics.OpenGL
internal extern static unsafe void VertexAttribI4usvEXT(UInt32 index, UInt16* v);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glVertexAttribIPointer", ExactSpelling = true)]
internal extern static void VertexAttribIPointer(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribParameter type, Int32 stride, IntPtr pointer);
internal extern static void VertexAttribIPointer(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribIPointerType type, Int32 stride, IntPtr pointer);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glVertexAttribIPointerEXT", ExactSpelling = true)]
internal extern static void VertexAttribIPointerEXT(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.NvVertexProgram4 type, Int32 stride, IntPtr pointer);

View file

@ -1524,7 +1524,7 @@ namespace OpenTK.Graphics.OpenGL
internal unsafe delegate void GetActiveUniformARB(UInt32 programObj, UInt32 index, Int32 maxLength, [OutAttribute] Int32* length, [OutAttribute] Int32* size, [OutAttribute] OpenTK.Graphics.OpenGL.ArbShaderObjects* type, [OutAttribute] StringBuilder name);
internal unsafe static GetActiveUniformARB glGetActiveUniformARB;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void GetActiveUniformBlockiv(UInt32 program, UInt32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ArbUniformBufferObject pname, [OutAttribute] Int32* @params);
internal unsafe delegate void GetActiveUniformBlockiv(UInt32 program, UInt32 uniformBlockIndex, OpenTK.Graphics.OpenGL.ActiveUniformBlockParameter pname, [OutAttribute] Int32* @params);
internal unsafe static GetActiveUniformBlockiv glGetActiveUniformBlockiv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void GetActiveUniformBlockName(UInt32 program, UInt32 uniformBlockIndex, Int32 bufSize, [OutAttribute] Int32* length, [OutAttribute] StringBuilder uniformBlockName);
@ -5337,7 +5337,7 @@ namespace OpenTK.Graphics.OpenGL
internal unsafe delegate void VertexAttribI4usvEXT(UInt32 index, UInt16* v);
internal unsafe static VertexAttribI4usvEXT glVertexAttribI4usvEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void VertexAttribIPointer(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribParameter type, Int32 stride, IntPtr pointer);
internal delegate void VertexAttribIPointer(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.VertexAttribIPointerType type, Int32 stride, IntPtr pointer);
internal static VertexAttribIPointer glVertexAttribIPointer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void VertexAttribIPointerEXT(UInt32 index, Int32 size, OpenTK.Graphics.OpenGL.NvVertexProgram4 type, Int32 stride, IntPtr pointer);

View file

@ -51,6 +51,17 @@ namespace OpenTK.Graphics.OpenGL
FloatMat4 = ((int)0x8B5C),
}
public enum ActiveUniformBlockParameter : int
{
UniformBlockBinding = ((int)0x8A3F),
UniformBlockDataSize = ((int)0x8A40),
UniformBlockNameLength = ((int)0x8A41),
UniformBlockActiveUniforms = ((int)0x8A42),
UniformBlockActiveUniformIndices = ((int)0x8A43),
UniformBlockReferencedByVertexShader = ((int)0x8A44),
UniformBlockReferencedByFragmentShader = ((int)0x8A46),
}
public enum ActiveUniformType : int
{
Int = ((int)0x1404),
@ -74,6 +85,8 @@ namespace OpenTK.Graphics.OpenGL
SamplerCube = ((int)0x8B60),
Sampler1DShadow = ((int)0x8B61),
Sampler2DShadow = ((int)0x8B62),
Sampler2DRect = ((int)0x8B63),
Sampler2DRectShadow = ((int)0x8B64),
FloatMat2x3 = ((int)0x8B65),
FloatMat2x4 = ((int)0x8B66),
FloatMat3x2 = ((int)0x8B67),
@ -82,6 +95,7 @@ namespace OpenTK.Graphics.OpenGL
FloatMat4x3 = ((int)0x8B6A),
Sampler1DArray = ((int)0x8DC0),
Sampler2DArray = ((int)0x8DC1),
SamplerBuffer = ((int)0x8DC2),
Sampler1DArrayShadow = ((int)0x8DC3),
Sampler2DArrayShadow = ((int)0x8DC4),
SamplerCubeShadow = ((int)0x8DC5),
@ -92,14 +106,18 @@ namespace OpenTK.Graphics.OpenGL
IntSampler2D = ((int)0x8DCA),
IntSampler3D = ((int)0x8DCB),
IntSamplerCube = ((int)0x8DCC),
IntSampler2DRect = ((int)0x8DCD),
IntSampler1DArray = ((int)0x8DCE),
IntSampler2DArray = ((int)0x8DCF),
IntSamplerBuffer = ((int)0x8DD0),
UnsignedIntSampler1D = ((int)0x8DD1),
UnsignedIntSampler2D = ((int)0x8DD2),
UnsignedIntSampler3D = ((int)0x8DD3),
UnsignedIntSamplerCube = ((int)0x8DD4),
UnsignedIntSampler2DRect = ((int)0x8DD5),
UnsignedIntSampler1DArray = ((int)0x8DD6),
UnsignedIntSampler2DArray = ((int)0x8DD7),
UnsignedIntSamplerBuffer = ((int)0x8DD8),
Sampler2DMultisample = ((int)0x9108),
IntSampler2DMultisample = ((int)0x9109),
UnsignedIntSampler2DMultisample = ((int)0x910A),
@ -5418,7 +5436,6 @@ namespace OpenTK.Graphics.OpenGL
Float = ((int)0x1406),
Double = ((int)0x140A),
HalfFloat = ((int)0x140B),
Bgra = ((int)0x80E1),
}
public enum ColorTableParameterPName : int
@ -7016,6 +7033,10 @@ namespace OpenTK.Graphics.OpenGL
Texture2D = ((int)0x0DE1),
Texture3D = ((int)0x806F),
TextureCubeMap = ((int)0x8513),
Texture1DArray = ((int)0x8C18),
Texture2DArray = ((int)0x8C1A),
Texture2DMultisample = ((int)0x9100),
Texture2DMultisampleArray = ((int)0x9102),
}
public enum GetColorTableParameterPName : int
@ -7566,6 +7587,8 @@ namespace OpenTK.Graphics.OpenGL
MaxRenderbufferSize = ((int)0x84E8),
MaxRenderbufferSizeExt = ((int)0x84E8),
TextureCompressionHint = ((int)0x84EF),
TextureBindingRectangle = ((int)0x84F6),
MaxRectangleTextureSize = ((int)0x84F8),
MaxTextureLodBias = ((int)0x84FD),
TextureCubeMap = ((int)0x8513),
TextureBindingCubeMap = ((int)0x8514),
@ -10440,8 +10463,10 @@ namespace OpenTK.Graphics.OpenGL
TextureMaxLod = ((int)0x813B),
TextureBaseLevel = ((int)0x813C),
TextureMaxLevel = ((int)0x813D),
TextureRectangle = ((int)0x84F5),
TextureRectangleArb = ((int)0x84F5),
TextureRectangleNv = ((int)0x84F5),
ProxyTextureRectangle = ((int)0x84F7),
TextureCubeMap = ((int)0x8513),
TextureBindingCubeMap = ((int)0x8514),
TextureCubeMapPositiveX = ((int)0x8515),
@ -10457,7 +10482,9 @@ namespace OpenTK.Graphics.OpenGL
ProxyTexture2DArray = ((int)0x8C1B),
TextureBuffer = ((int)0x8C2A),
Texture2DMultisample = ((int)0x9100),
ProxyTexture2DMultisample = ((int)0x9101),
Texture2DMultisampleArray = ((int)0x9102),
ProxyTexture2DMultisampleArray = ((int)0x9103),
}
public enum TextureTargetMultisample : int
@ -11879,6 +11906,16 @@ namespace OpenTK.Graphics.OpenGL
TimeoutIgnored = unchecked((int)0xFFFFFFFFFFFFFFFF),
}
public enum VertexAttribIPointerType : int
{
Byte = ((int)0x1400),
UnsignedByte = ((int)0x1401),
Short = ((int)0x1402),
UnsignedShort = ((int)0x1403),
Int = ((int)0x1404),
UnsignedInt = ((int)0x1405),
}
public enum VertexAttribParameter : int
{
ArrayEnabled = ((int)0x8622),
@ -11922,7 +11959,6 @@ namespace OpenTK.Graphics.OpenGL
Float = ((int)0x1406),
Double = ((int)0x140A),
HalfFloat = ((int)0x140B),
Bgra = ((int)0x80E1),
}
public enum VertexAttribPointerTypeArb : int

View file

@ -46,7 +46,7 @@ namespace OpenTK.Input
IntPtr id;
int numButtons, numWheels;
readonly bool[] button_state = new bool[Enum.GetValues(typeof(MouseButton)).Length];
int wheel, last_wheel;
float wheel, last_wheel;
Point pos = new Point(), last_pos = new Point();
MouseMoveEventArgs move_args = new MouseMoveEventArgs();
MouseButtonEventArgs button_args = new MouseButtonEventArgs();
@ -131,9 +131,19 @@ namespace OpenTK.Input
#region public int Wheel
/// <summary>
/// Gets an integer representing the absolute wheel position.
/// Gets the absolute wheel position in integer units.
/// To support high-precision mice, it is recommended to use <see cref="WheelPrecise"/> instead.
/// </summary>
public int Wheel
{
get { return (int)(wheel + 0.5f); }
internal set { WheelPrecise = value; }
}
/// <summary>
/// Gets the absolute wheel position in floating-point units.
/// </summary>
public float WheelPrecise
{
get { return wheel; }
internal set
@ -142,11 +152,11 @@ namespace OpenTK.Input
wheel_args.X = pos.X;
wheel_args.Y = pos.Y;
wheel_args.Value = wheel;
wheel_args.Delta = wheel - last_wheel;
WheelChanged(this, wheel_args );
wheel_args.ValuePrecise = wheel;
wheel_args.DeltaPrecise = wheel - last_wheel;
WheelChanged(this, wheel_args);
last_wheel = wheel;
}
}
@ -296,8 +306,8 @@ namespace OpenTK.Input
{
get
{
int result = wheel - wheel_last_accessed;
wheel_last_accessed = wheel;
int result = (int)(wheel - wheel_last_accessed + 0.5f);
wheel_last_accessed = (int)wheel;
return result;
}
}
@ -561,8 +571,8 @@ namespace OpenTK.Input
{
#region Fields
int value;
int delta;
float value;
float delta;
#endregion
@ -601,14 +611,26 @@ namespace OpenTK.Input
#region Public Members
/// <summary>
/// Gets the value of the wheel.
/// Gets the value of the wheel in integer units.
/// To support high-precision mice, it is recommended to use <see cref="ValuePrecise"/> instead.
/// </summary>
public int Value { get { return this.value; } internal set { this.value = value; } }
public int Value { get { return (int)(value + 0.5f); } }
/// <summary>
/// Gets the change in value of the wheel for this event.
/// Gets the change in value of the wheel for this event in integer units.
/// To support high-precision mice, it is recommended to use <see cref="DeltaPrecise"/> instead.
/// </summary>
public int Delta { get { return delta; } internal set { delta = value; } }
public int Delta { get { return (int)(delta + 0.5f); } }
/// <summary>
/// Gets the precise value of the wheel in floating-point units.
/// </summary>
public float ValuePrecise { get { return value; } internal set { this.value = value; } }
/// <summary>
/// Gets the precise change in value of the wheel for this event in floating-point units.
/// </summary>
public float DeltaPrecise { get { return delta; } internal set { delta = value; } }
#endregion
}

View file

@ -908,12 +908,10 @@ namespace OpenTK
/// <param name="result">The result of the operation.</param>
public static void Transform(ref Vector2 vec, ref Quaternion quat, out Vector2 result)
{
Quaternion v = new Quaternion(vec.X, vec.Y, 0, 0);
Quaternion i;
Quaternion t;
Quaternion v = new Quaternion(vec.X, vec.Y, 0, 0), i, t;
Quaternion.Invert(ref quat, out i);
t = i * v;
v = t * quat;
Quaternion.Multiply(ref quat, ref v, out t);
Quaternion.Multiply(ref t, ref i, out v);
result = new Vector2(v.X, v.Y);
}

View file

@ -796,12 +796,10 @@ namespace OpenTK
/// <param name="result">The result of the operation.</param>
public static void Transform(ref Vector2d vec, ref Quaterniond quat, out Vector2d result)
{
Quaterniond v = new Quaterniond(vec.X, vec.Y, 0, 0);
Quaterniond i;
Quaterniond t;
Quaterniond v = new Quaterniond(vec.X, vec.Y, 0, 0), i, t;
Quaterniond.Invert(ref quat, out i);
t = i * v;
v = t * quat;
Quaterniond.Multiply(ref quat, ref v, out t);
Quaterniond.Multiply(ref t, ref i, out v);
result = new Vector2d(v.X, v.Y);
}

View file

@ -837,9 +837,9 @@ namespace OpenTK
/// <returns>The cross product of the two inputs</returns>
public static Vector3 Cross(Vector3 left, Vector3 right)
{
return new Vector3(left.Y * right.Z - left.Z * right.Y,
left.Z * right.X - left.X * right.Z,
left.X * right.Y - left.Y * right.X);
Vector3 result;
Cross(ref left, ref right, out result);
return result;
}
/// <summary>
@ -851,9 +851,9 @@ namespace OpenTK
/// <param name="result">The cross product of the two inputs</param>
public static void Cross(ref Vector3 left, ref Vector3 right, out Vector3 result)
{
result.X = left.Y * right.Z - left.Z * right.Y;
result.Y = left.Z * right.X - left.X * right.Z;
result.Z = left.X * right.Y - left.Y * right.X;
result = new Vector3(left.Y * right.Z - left.Z * right.Y,
left.Z * right.X - left.X * right.Z,
left.X * right.Y - left.Y * right.X);
}
#endregion
@ -1115,14 +1115,15 @@ namespace OpenTK
/// <param name="result">The result of the operation.</param>
public static void Transform(ref Vector3 vec, ref Quaternion quat, out Vector3 result)
{
Quaternion v = new Quaternion(vec.X, vec.Y, vec.Z, 0);
Quaternion i;
Quaternion t;
Quaternion.Invert(ref quat, out i);
t = i * v;
v = t * quat;
result = new Vector3(v.X, v.Y, v.Z);
// Since vec.W == 0, we can optimize quat * vec * quat^-1 as follows:
// vec + 2.0 * cross(quat.xyz, cross(quat.xyz, vec) + quat.w * vec)
Vector3 xyz = quat.Xyz, temp, temp2;
Vector3.Cross(ref xyz, ref vec, out temp);
Vector3.Multiply(ref vec, quat.W, out temp2);
Vector3.Add(ref temp, ref temp2, out temp);
Vector3.Cross(ref xyz, ref temp, out temp);
Vector3.Multiply(ref temp, 2, out temp);
Vector3.Add(ref vec, ref temp, out result);
}
/// <summary>Transform a Vector3 by the given Matrix, and project the resulting Vector4 back to a Vector3</summary>

View file

@ -836,9 +836,9 @@ namespace OpenTK
/// <returns>The cross product of the two inputs</returns>
public static Vector3d Cross(Vector3d left, Vector3d right)
{
return new Vector3d(left.Y * right.Z - left.Z * right.Y,
left.Z * right.X - left.X * right.Z,
left.X * right.Y - left.Y * right.X);
Vector3d result;
Cross(ref left, ref right, out result);
return result;
}
/// <summary>
@ -850,9 +850,9 @@ namespace OpenTK
/// <param name="result">The cross product of the two inputs</param>
public static void Cross(ref Vector3d left, ref Vector3d right, out Vector3d result)
{
result.X = left.Y * right.Z - left.Z * right.Y;
result.Y = left.Z * right.X - left.X * right.Z;
result.Z = left.X * right.Y - left.Y * right.X;
result = new Vector3d(left.Y * right.Z - left.Z * right.Y,
left.Z * right.X - left.X * right.Z,
left.X * right.Y - left.Y * right.X);
}
#endregion
@ -1111,14 +1111,15 @@ namespace OpenTK
/// <param name="result">The result of the operation.</param>
public static void Transform(ref Vector3d vec, ref Quaterniond quat, out Vector3d result)
{
Quaterniond v = new Quaterniond(vec.X, vec.Y, vec.Z, 0);
Quaterniond i;
Quaterniond t;
Quaterniond.Invert(ref quat, out i);
t = i * v;
v = t * quat;
result = new Vector3d(v.X, v.Y, v.Z);
// Since vec.W == 0, we can optimize quat * vec * quat^-1 as follows:
// vec + 2.0 * cross(quat.xyz, cross(quat.xyz, vec) + quat.w * vec)
Vector3d xyz = quat.Xyz, temp, temp2;
Vector3d.Cross(ref xyz, ref vec, out temp);
Vector3d.Multiply(ref vec, quat.W, out temp2);
Vector3d.Add(ref temp, ref temp2, out temp);
Vector3d.Cross(ref xyz, ref temp, out temp);
Vector3d.Multiply(ref temp, 2, out temp);
Vector3d.Add(ref vec, ref temp, out result);
}
/// <summary>

View file

@ -963,12 +963,10 @@ namespace OpenTK
/// <param name="result">The result of the operation.</param>
public static void Transform(ref Vector4 vec, ref Quaternion quat, out Vector4 result)
{
Quaternion v = new Quaternion(vec.X, vec.Y, vec.Z, vec.W);
Quaternion i;
Quaternion t;
Quaternion v = new Quaternion(vec.X, vec.Y, vec.Z, vec.W), i, t;
Quaternion.Invert(ref quat, out i);
t = i * v;
v = t * quat;
Quaternion.Multiply(ref quat, ref v, out t);
Quaternion.Multiply(ref t, ref i, out v);
result = new Vector4(v.X, v.Y, v.Z, v.W);
}

View file

@ -966,12 +966,10 @@ namespace OpenTK
/// <param name="result">The result of the operation.</param>
public static void Transform(ref Vector4d vec, ref Quaterniond quat, out Vector4d result)
{
Quaterniond v = new Quaterniond(vec.X, vec.Y, vec.Z, vec.W);
Quaterniond i;
Quaterniond t;
Quaterniond v = new Quaterniond(vec.X, vec.Y, vec.Z, vec.W), i, t;
Quaterniond.Invert(ref quat, out i);
t = i * v;
v = t * quat;
Quaterniond.Multiply(ref quat, ref v, out t);
Quaterniond.Multiply(ref t, ref i, out v);
result = new Vector4d(v.X, v.Y, v.Z, v.W);
}

View file

@ -1,4 +1,31 @@
using System;
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.ComponentModel;
using System.Drawing;
using OpenTK.Graphics;

View file

@ -358,6 +358,7 @@ namespace OpenTK.Platform.MacOS
#endregion
#region IDisposable Members
~AglContext()
{
Dispose(false);
@ -374,25 +375,20 @@ namespace OpenTK.Platform.MacOS
return;
Debug.Print("Disposing of AGL context.");
try
{
throw new Exception();
}
catch (Exception e)
{
Debug.WriteLine(e.StackTrace);
}
Agl.aglSetCurrentContext(IntPtr.Zero);
Agl.aglSetDrawable(Handle.Handle, IntPtr.Zero);
Debug.Print("Set drawable to null for context {0}.", Handle.Handle);
//Debug.Print("Setting drawable to null for context {0}.", Handle.Handle);
//Agl.aglSetDrawable(Handle.Handle, IntPtr.Zero);
// I do not know MacOS allows us to destroy a context from a separate thread,
// like the finalizer thread. It's untested, but worst case is probably
// an exception on application exit, which would be logged to the console.
Debug.Print("Destroying context");
if (Agl.aglDestroyContext(Handle.Handle) == true)
{
Handle = ContextHandle.Zero;
return;
Debug.Print("Context destruction completed successfully.");
Handle = ContextHandle.Zero;
return;
}
// failed to destroy context.

View file

@ -40,8 +40,21 @@ namespace OpenTK.Platform.MacOS.Carbon
API.Gestalt(GestaltSelector.SystemVersionBugFix, out osBugfix);
Debug.Print("Running on Mac OS X {0}.{1}.{2}.", osMajor, osMinor, osBugfix);
TransformProcessToForeground();
}
private static void TransformProcessToForeground()
{
Carbon.ProcessSerialNumber psn = new ProcessSerialNumber();
Debug.Print("Setting process to be foreground application.");
API.GetCurrentProcess(ref psn);
API.TransformProcessType(ref psn, ProcessApplicationTransformState.kProcessTransformToForegroundApplication);
API.SetFrontProcess(ref psn);
}
internal static CarbonGLNative WindowEventHandler
{
get { return eventHandler; }

View file

@ -11,6 +11,8 @@ using System;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Drawing;
using EventTime = System.Double;
namespace OpenTK.Platform.MacOS.Carbon
{
@ -121,6 +123,13 @@ namespace OpenTK.Platform.MacOS.Carbon
#region --- Types defined in CarbonEvents.h ---
enum EventAttributes : uint
{
kEventAttributeNone = 0,
kEventAttributeUserEvent = (1 << 0),
kEventAttributeMonitored = 1 << 3,
}
[StructLayout(LayoutKind.Sequential)]
internal struct EventTypeSpec
{
@ -238,6 +247,8 @@ namespace OpenTK.Platform.MacOS.Carbon
internal enum EventParamName : int
{
WindowRef = 0x77696e64, // typeWindowRef,
// Mouse Events
MouseLocation = 0x6d6c6f63, // typeHIPoint
WindowMouseLocation = 0x776d6f75, // typeHIPoint
@ -255,6 +266,8 @@ namespace OpenTK.Platform.MacOS.Carbon
}
internal enum EventParamType : int
{
typeWindowRef = 0x77696e64,
typeMouseButton = 0x6d62746e,
typeMouseWheelAxis = 0x6d776178,
typeHIPoint = 0x68697074,
@ -388,14 +401,29 @@ namespace OpenTK.Platform.MacOS.Carbon
};
#endregion
#region --- Process Manager ---
enum HICoordinateSpace
enum ProcessApplicationTransformState : int
{
kProcessTransformToForegroundApplication = 1,
}
struct ProcessSerialNumber
{
public ulong high;
public ulong low;
}
#endregion
enum HICoordinateSpace
{
_72DPIGlobal = 1,
ScreenPixel = 2,
Window = 3,
View = 4
};
};
#region --- Carbon API Methods ---
@ -488,6 +516,12 @@ namespace OpenTK.Platform.MacOS.Carbon
[DllImport(carbon)]
static extern void ReleaseEvent(IntPtr theEvent);
internal static void SendEvent(IntPtr theEvent)
{
IntPtr theTarget = GetEventDispatcherTarget();
SendEventToEventTarget(theEvent, theTarget);
}
// Processes events in the queue and then returns.
internal static void ProcessEvents()
{
@ -558,6 +592,26 @@ namespace OpenTK.Platform.MacOS.Carbon
#endregion
#region --- Getting Event Parameters ---
[DllImport(carbon,EntryPoint="CreateEvent")]
static extern OSStatus _CreateEvent( IntPtr inAllocator,
EventClass inClassID, UInt32 kind, EventTime when,
EventAttributes flags,out IntPtr outEvent);
internal static IntPtr CreateWindowEvent(WindowEventKind kind)
{
IntPtr retval;
OSStatus stat = _CreateEvent(IntPtr.Zero, EventClass.Window, (uint)kind,
0, EventAttributes.kEventAttributeNone, out retval);
if (stat != OSStatus.NoError)
{
throw new MacOSException(stat);
}
return retval;
}
[DllImport(carbon)]
static extern OSStatus GetEventParameter(
IntPtr inEvent, EventParamName inName, EventParamType inDesiredType,
@ -626,6 +680,25 @@ namespace OpenTK.Platform.MacOS.Carbon
return (MouseButton)button;
}
static internal int GetEventMouseWheelDelta(IntPtr inEvent)
{
int delta;
unsafe
{
int* d = &delta;
OSStatus result = API.GetEventParameter(inEvent,
EventParamName.MouseWheelDelta, EventParamType.typeSInt32,
IntPtr.Zero, (uint)sizeof(int), IntPtr.Zero, (IntPtr)d);
if (result != OSStatus.NoError)
throw new MacOSException(result);
}
return delta;
}
static internal OSStatus GetEventWindowMouseLocation(IntPtr inEvent, out HIPoint pt)
{
HIPoint point;
@ -645,6 +718,24 @@ namespace OpenTK.Platform.MacOS.Carbon
}
}
static internal OSStatus GetEventWindowRef(IntPtr inEvent, out IntPtr windowRef)
{
IntPtr retval;
unsafe
{
IntPtr* parm = &retval;
OSStatus result = API.GetEventParameter(inEvent,
EventParamName.WindowRef, EventParamType.typeWindowRef, IntPtr.Zero,
(uint)sizeof(IntPtr), IntPtr.Zero, (IntPtr)parm);
windowRef = retval;
return result;
}
}
static internal OSStatus GetEventMouseLocation(IntPtr inEvent, out HIPoint pt)
{
HIPoint point;
@ -756,8 +847,32 @@ namespace OpenTK.Platform.MacOS.Carbon
internal static extern void DisposeEventHandlerUPP(IntPtr userUPP);
#endregion
#region --- Process Manager ---
[DllImport(carbon)]
[DllImport(carbon)]
internal static extern int TransformProcessType(ref Carbon.ProcessSerialNumber psn, ProcessApplicationTransformState type);
[DllImport(carbon)]
internal static extern int GetCurrentProcess(ref Carbon.ProcessSerialNumber psn);
[DllImport(carbon)]
internal static extern int SetFrontProcess(ref Carbon.ProcessSerialNumber psn);
#endregion
#region --- Setting Dock Tile ---
[DllImport(carbon)]
internal extern static IntPtr CGColorSpaceCreateDeviceRGB();
[DllImport(carbon)]
internal extern static IntPtr CGDataProviderCreateWithData(IntPtr info, IntPtr[] data, int size, IntPtr releasefunc);
[DllImport(carbon)]
internal extern static IntPtr CGImageCreate(int width, int height, int bitsPerComponent, int bitsPerPixel, int bytesPerRow, IntPtr colorspace, uint bitmapInfo, IntPtr provider, IntPtr decode, int shouldInterpolate, int intent);
[DllImport(carbon)]
internal extern static void SetApplicationDockTileImage(IntPtr imageRef);
[DllImport(carbon)]
internal extern static void RestoreApplicationDockTileImage();
#endregion
[DllImport(carbon)]
static extern IntPtr GetControlBounds(IntPtr control, out Rect bounds);
internal static Rect GetControlBounds(IntPtr control)

View file

@ -121,7 +121,4 @@ namespace OpenTK.Platform.MacOS.Carbon
Command = 0x0100, // Open-Apple - Windows key
Option = 0x0800, // Option key is same position as the alt key on non-mac keyboards.
}
partial class API
{
}
}

View file

@ -43,6 +43,8 @@ namespace OpenTK.Platform.MacOS
CarbonWindowInfo window;
CarbonInput mInputDriver;
[Obsolete]
GraphicsContext context;
static MacOSKeyMap Keymap = new MacOSKeyMap();
@ -50,7 +52,8 @@ namespace OpenTK.Platform.MacOS
IntPtr uppHandler;
string title = "OpenTK Window";
Rectangle bounds, windowedBounds, clientRectangle;
Rectangle bounds, clientRectangle;
Rectangle windowedBounds;
bool mIsDisposed = false;
bool mExists = true;
DisplayDevice mDisplayDevice;
@ -64,6 +67,13 @@ namespace OpenTK.Platform.MacOS
static Dictionary<IntPtr, WeakReference> mWindows = new Dictionary<IntPtr, WeakReference>();
KeyPressEventArgs mKeyPressArgs = new KeyPressEventArgs((char)0);
bool mMouseIn = false;
bool mIsActive = false;
Icon mIcon;
#endregion
#region AGL Device Hack
@ -122,6 +132,8 @@ namespace OpenTK.Platform.MacOS
Debug.Print("Disposing of CarbonGLNative window.");
API.DisposeWindow(window.WindowRef);
mIsDisposed = true;
mExists = false;
@ -134,6 +146,7 @@ namespace OpenTK.Platform.MacOS
}
DisposeUPP();
}
~CarbonGLNative()
@ -195,6 +208,8 @@ namespace OpenTK.Platform.MacOS
new EventTypeSpec(EventClass.Window, WindowEventKind.WindowClose),
new EventTypeSpec(EventClass.Window, WindowEventKind.WindowClosed),
new EventTypeSpec(EventClass.Window, WindowEventKind.WindowBoundsChanged),
new EventTypeSpec(EventClass.Window, WindowEventKind.WindowActivate),
new EventTypeSpec(EventClass.Window, WindowEventKind.WindowDeactivate),
//new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseDown),
//new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseUp),
@ -245,6 +260,7 @@ namespace OpenTK.Platform.MacOS
Debug.Print("Prev Size: {0}, {1}", Width, Height);
// TODO: if we go full screen we need to make this use the device specified.
bounds = DisplayDevice.Default.Bounds;
Debug.Print("New Size: {0}, {1}", Width, Height);
@ -331,25 +347,35 @@ namespace OpenTK.Platform.MacOS
private OSStatus ProcessKeyboardEvent(IntPtr inCaller, IntPtr inEvent, EventInfo evt, IntPtr userData)
{
System.Diagnostics.Debug.Assert(evt.EventClass == EventClass.Keyboard);
MacOSKeyCode code;
char charCode;
MacOSKeyCode code = (MacOSKeyCode)0;
char charCode = '\0';
//Debug.Print("Processing keyboard event {0}", evt.KeyboardEventKind);
switch (evt.KeyboardEventKind)
{
case KeyboardEventKind.RawKeyDown:
case KeyboardEventKind.RawKeyRepeat:
case KeyboardEventKind.RawKeyUp:
GetCharCodes(inEvent, out code, out charCode);
mKeyPressArgs.KeyChar = charCode;
break;
}
switch (evt.KeyboardEventKind)
{
case KeyboardEventKind.RawKeyRepeat:
GetCharCodes(inEvent, out code, out charCode);
InputDriver.Keyboard[0].KeyRepeat = true;
goto case KeyboardEventKind.RawKeyDown;
case KeyboardEventKind.RawKeyDown:
GetCharCodes(inEvent, out code, out charCode);
OnKeyPress(mKeyPressArgs);
InputDriver.Keyboard[0][Keymap[code]] = true;
return OSStatus.EventNotHandled;
case KeyboardEventKind.RawKeyUp:
GetCharCodes(inEvent, out code, out charCode);
InputDriver.Keyboard[0][Keymap[code]] = false;
return OSStatus.EventNotHandled;
case KeyboardEventKind.RawKeyModifiersChanged:
@ -362,6 +388,7 @@ namespace OpenTK.Platform.MacOS
}
private OSStatus ProcessWindowEvent(IntPtr inCaller, IntPtr inEvent, EventInfo evt, IntPtr userData)
{
System.Diagnostics.Debug.Assert(evt.EventClass == EventClass.Window);
@ -394,6 +421,14 @@ namespace OpenTK.Platform.MacOS
return OSStatus.EventNotHandled;
case WindowEventKind.WindowActivate:
OnActivate();
return OSStatus.EventNotHandled;
case WindowEventKind.WindowDeactivate:
OnDeactivate();
return OSStatus.EventNotHandled;
default:
Debug.Print("{0}", evt);
@ -405,12 +440,13 @@ namespace OpenTK.Platform.MacOS
System.Diagnostics.Debug.Assert(evt.EventClass == EventClass.Mouse);
MouseButton button = MouseButton.Primary;
HIPoint pt = new HIPoint();
HIPoint screenLoc = new HIPoint();
OSStatus err;
OSStatus err = API.GetEventMouseLocation(inEvent, out screenLoc);
if (this.windowState == WindowState.Fullscreen)
{
err = API.GetEventMouseLocation(inEvent, out pt);
pt = screenLoc;
}
else
{
@ -426,21 +462,17 @@ namespace OpenTK.Platform.MacOS
}
}
Point mousePosInClient = new Point((int)pt.X, (int)pt.Y);
if (this.windowState != WindowState.Fullscreen)
{
mousePosInClient.Y -= mTitlebarHeight;
}
if (this.windowState == WindowState.Fullscreen)
{
InputDriver.Mouse[0].Position = new Point((int)pt.X, (int)pt.Y);
}
else
{
// ignore clicks in the title bar
if (pt.Y < mTitlebarHeight)
return OSStatus.EventNotHandled;
InputDriver.Mouse[0].Position =
new Point((int)pt.X, (int)(pt.Y - mTitlebarHeight));
}
// check for enter/leave events
IntPtr thisEventWindow;
API.GetEventWindowRef(inEvent, out thisEventWindow);
CheckEnterLeaveEvents(thisEventWindow, mousePosInClient);
switch (evt.MouseEventKind)
{
case MouseEventKind.MouseDown:
@ -462,9 +494,11 @@ namespace OpenTK.Platform.MacOS
}
break;
return OSStatus.NoError;
case MouseEventKind.MouseUp:
button = API.GetEventMouseButton(inEvent);
switch (button)
{
case MouseButton.Primary:
@ -482,12 +516,41 @@ namespace OpenTK.Platform.MacOS
button = API.GetEventMouseButton(inEvent);
break;
return OSStatus.NoError;
case MouseEventKind.WheelMoved:
int delta = API.GetEventMouseWheelDelta(inEvent) / 3;
InputDriver.Mouse[0].Wheel += delta;
return OSStatus.NoError;
case MouseEventKind.MouseMoved:
case MouseEventKind.MouseDragged:
//Debug.Print("Mouse Location: {0}, {1}", pt.X, pt.Y);
//Debug.Print("MouseMoved: {0}", InputDriver.Mouse[0].Position);
if (this.windowState == WindowState.Fullscreen)
{
if (mousePosInClient.X != InputDriver.Mouse[0].X ||
mousePosInClient.Y != InputDriver.Mouse[0].Y)
{
InputDriver.Mouse[0].Position = mousePosInClient;
}
}
else
{
// ignore clicks in the title bar
if (pt.Y < 0)
return OSStatus.EventNotHandled;
if (mousePosInClient.X != InputDriver.Mouse[0].X ||
mousePosInClient.Y != InputDriver.Mouse[0].Y)
{
InputDriver.Mouse[0].Position = mousePosInClient;
}
}
return OSStatus.EventNotHandled;
@ -496,10 +559,29 @@ namespace OpenTK.Platform.MacOS
return OSStatus.EventNotHandled;
}
return OSStatus.EventNotHandled;
}
private void CheckEnterLeaveEvents(IntPtr eventWindowRef, Point pt)
{
if (window == null)
return;
bool thisIn = eventWindowRef == window.WindowRef;
if (pt.Y < 0)
thisIn = false;
if (thisIn != mMouseIn)
{
mMouseIn = thisIn;
if (mMouseIn)
OnMouseEnter();
else
OnMouseLeave();
}
}
private static void GetCharCodes(IntPtr inEvent, out MacOSKeyCode code, out char charCode)
{
code = API.GetEventKeyboardKeyCode(inEvent);
@ -556,34 +638,19 @@ namespace OpenTK.Platform.MacOS
if (WindowState == WindowState.Fullscreen)
return;
// Todo: why call SizeWindow twice?
// The bounds of the window should be the size specified, but
// API.SizeWindow sets the content region size. So
// we reduce the size to get the correct bounds.
width -= (short)(bounds.Width - clientRectangle.Width);
height -= (short)(bounds.Height - clientRectangle.Height);
API.SizeWindow(window.WindowRef, width, height, true);
bounds.Width = (short)width;
bounds.Height = (short)height;
Rect contentBounds = API.GetWindowBounds(window.WindowRef, WindowRegionCode.ContentRegion);
Rect newSize = new Rect(0, 0,
(short)(2 * width - contentBounds.Width),
(short)(2 * height - contentBounds.Height));
Debug.Print("Content region was: {0}", contentBounds);
Debug.Print("Resizing window to: {0}", newSize);
API.SizeWindow(window.WindowRef, newSize.Width, newSize.Height, true);
contentBounds = API.GetWindowBounds(window.WindowRef, WindowRegionCode.ContentRegion);
Debug.Print("New content region size: {0}", contentBounds);
clientRectangle = contentBounds.ToRectangle();
}
protected void OnResize()
{
LoadSize();
if (context != null && this.windowState != WindowState.Fullscreen)
context.Update(window);
if (Resize != null)
{
Resize(this, EventArgs.Empty);
@ -595,19 +662,11 @@ namespace OpenTK.Platform.MacOS
if (WindowState == WindowState.Fullscreen)
return;
bounds = GetRegion().ToRectangle();
}
Rect r = API.GetWindowBounds(window.WindowRef, WindowRegionCode.StructureRegion);
bounds = new Rectangle(r.X, r.Y, r.Width, r.Height);
protected virtual void OnClosing(CancelEventArgs e)
{
if (Closing != null)
Closing(this, e);
}
protected virtual void OnClosed()
{
if (Closed != null)
Closed(this, EventArgs.Empty);
r = API.GetWindowBounds(window.WindowRef, WindowRegionCode.GlobalPortRegion);
clientRectangle = new Rectangle(0, 0, r.Width, r.Height);
}
#endregion
@ -691,10 +750,63 @@ namespace OpenTK.Platform.MacOS
public Icon Icon
{
get { return null; }
set { }
get { return mIcon; }
set {
SetIcon(value);
}
}
private void SetIcon(Icon icon)
{
// The code for this function was adapted from Mono's
// XplatUICarbon implementation, written by Geoff Norton
// http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs?view=markup&pathrev=136932
if (icon == null)
{
API.RestoreApplicationDockTileImage();
}
else
{
Bitmap bitmap;
int size;
IntPtr[] data;
int index;
bitmap = new Bitmap(128, 128);
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap))
{
g.DrawImage(icon.ToBitmap(), 0, 0, 128, 128);
}
index = 0;
size = bitmap.Width * bitmap.Height;
data = new IntPtr[size];
for (int y = 0; y < bitmap.Height; y++)
{
for (int x = 0; x < bitmap.Width; x++)
{
int pixel = bitmap.GetPixel(x, y).ToArgb();
if (BitConverter.IsLittleEndian)
{
byte a = (byte)((pixel >> 24) & 0xFF);
byte r = (byte)((pixel >> 16) & 0xFF);
byte g = (byte)((pixel >> 8) & 0xFF);
byte b = (byte)(pixel & 0xFF);
data[index++] = (IntPtr)(a + (r << 8) + (g << 16) + (b << 24));
}
else
{
data[index++] = (IntPtr)pixel;
}
}
}
IntPtr provider = API.CGDataProviderCreateWithData(IntPtr.Zero, data, size * 4, IntPtr.Zero);
IntPtr image = API.CGImageCreate(128, 128, 8, 32, 4 * 128, API.CGColorSpaceCreateDeviceRGB(), 4, provider, IntPtr.Zero, 0, 0);
API.SetApplicationDockTileImage(image);
}
}
public string Title
{
get
@ -722,14 +834,15 @@ namespace OpenTK.Platform.MacOS
public bool Focused
{
get { throw new NotImplementedException(); }
get { return this.mIsActive; }
}
public Rectangle Bounds
{
get
{
return bounds;
return bounds;
}
set
{
@ -742,7 +855,7 @@ namespace OpenTK.Platform.MacOS
{
get
{
return bounds.Location;
return Bounds.Location;
}
set
{
@ -759,7 +872,6 @@ namespace OpenTK.Platform.MacOS
set
{
SetSize((short)value.Width, (short)value.Height);
context.Update(WindowInfo);
}
}
@ -803,11 +915,13 @@ namespace OpenTK.Platform.MacOS
{
get
{
return clientRectangle;
return clientRectangle;
}
set
{
throw new NotImplementedException();
// just set the size, and ignore the location value.
// this is the behavior of the Windows WinGLNative.
ClientSize = value.Size;
}
}
@ -819,13 +933,22 @@ namespace OpenTK.Platform.MacOS
}
set
{
throw new NotImplementedException();
API.SizeWindow(window.WindowRef, (short)value.Width, (short)value.Height, true);
OnResize();
}
}
public void Close()
{
throw new NotImplementedException();
CancelEventArgs e = new CancelEventArgs();
OnClosing(e);
if (e.Cancel)
return;
OnClosed();
Dispose();
}
public WindowState WindowState
@ -894,8 +1017,7 @@ namespace OpenTK.Platform.MacOS
windowState = value;
if (WindowStateChanged != null)
WindowStateChanged(this, EventArgs.Empty);
OnWindowStateChanged();
OnResize();
}
@ -928,44 +1050,81 @@ namespace OpenTK.Platform.MacOS
WindowBorderChanged(this, EventArgs.Empty);
}
}
}
}
public event EventHandler<EventArgs> Idle;
#region --- Event wrappers ---
private void OnKeyPress(KeyPressEventArgs keyPressArgs)
{
if (KeyPress != null)
KeyPress(this, keyPressArgs);
}
private void OnWindowStateChanged()
{
if (WindowStateChanged != null)
WindowStateChanged(this, EventArgs.Empty);
}
protected virtual void OnClosing(CancelEventArgs e)
{
if (Closing != null)
Closing(this, e);
}
protected virtual void OnClosed()
{
if (Closed != null)
Closed(this, EventArgs.Empty);
}
private void OnMouseLeave()
{
if (MouseLeave != null)
MouseLeave(this, EventArgs.Empty);
}
private void OnMouseEnter()
{
if (MouseEnter != null)
MouseEnter(this, EventArgs.Empty);
}
private void OnActivate()
{
mIsActive = true;
if (FocusedChanged != null)
FocusedChanged(this, EventArgs.Empty);
}
private void OnDeactivate()
{
mIsActive = false;
if (FocusedChanged != null)
FocusedChanged(this, EventArgs.Empty);
}
#endregion
public event EventHandler<EventArgs> Idle;
public event EventHandler<EventArgs> Load;
public event EventHandler<EventArgs> Unload;
public event EventHandler<EventArgs> Move;
public event EventHandler<EventArgs> Resize;
public event EventHandler<CancelEventArgs> Closing;
public event EventHandler<EventArgs> Closed;
public event EventHandler<EventArgs> Disposed;
public event EventHandler<EventArgs> IconChanged;
public event EventHandler<EventArgs> TitleChanged;
public event EventHandler<EventArgs> ClientSizeChanged;
public event EventHandler<EventArgs> VisibleChanged;
public event EventHandler<EventArgs> WindowInfoChanged;
public event EventHandler<EventArgs> FocusedChanged;
public event EventHandler<EventArgs> WindowBorderChanged;
public event EventHandler<EventArgs> WindowStateChanged;
public event EventHandler<KeyPressEventArgs> KeyPress;
public event EventHandler<EventArgs> MouseEnter;
public event EventHandler<EventArgs> MouseLeave;
#endregion

View file

@ -293,8 +293,8 @@ namespace OpenTK.Platform.Windows
case WindowMessage.MOUSEMOVE:
Point point = new Point(
(int)(lParam.ToInt32() & 0x0000FFFF),
(int)(lParam.ToInt32() & 0xFFFF0000) >> 16);
(short)((uint)lParam.ToInt32() & 0x0000FFFF),
(short)(((uint)lParam.ToInt32() & 0xFFFF0000) >> 16));
mouse.Position = point;
{
if (!ClientRectangle.Contains(point))
@ -316,7 +316,7 @@ namespace OpenTK.Platform.Windows
case WindowMessage.MOUSEWHEEL:
// This is due to inconsistent behavior of the WParam value on 64bit arch, whese
// wparam = 0xffffffffff880000 or wparam = 0x00000000ff100000
mouse.Wheel += (int)((long)wParam << 32 >> 48) / 120;
mouse.WheelPrecise += ((long)wParam << 32 >> 48) / 120.0f;
break;
case WindowMessage.LBUTTONDOWN:

View file

@ -74,24 +74,15 @@ namespace OpenTK.Platform.X11
{
Debug.Print("Initializing threaded X11: {0}.", Functions.XInitThreads().ToString());
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
// Bad idea - Windows.Forms will steal our events!
//Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
//defaultDisplay = (IntPtr)xplatui.GetField("DisplayHandle", System.Reflection.BindingFlags.Static |
// System.Reflection.BindingFlags.NonPublic).GetValue(null);
defaultDisplay = Functions.XOpenDisplay(IntPtr.Zero);
if (defaultDisplay == IntPtr.Zero)
throw new PlatformException("Could not establish connection to the X-Server.");
//defaultScreen = Functions.XDefaultScreen(DefaultDisplay);
//rootWindow = Functions.XRootWindow(DefaultDisplay, DefaultScreen);
screenCount = Functions.XScreenCount(DefaultDisplay);
//Debug.Print("Default Display: {0}, Default Screen: {1}, Default Root Window: {2}, Screen Count: {3}",
// DefaultDisplay, DefaultScreen, RootWindow, ScreenCount);
Debug.Print("Display connection: {0}, Screen count: {1}", DefaultDisplay, ScreenCount);
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
}
static void CurrentDomain_ProcessExit(object sender, EventArgs e)