Updated OpenGL bindings: 'v' suffixes are now trimmed from all functions.

Added Matrix4 and Vector* overloads to Uniform* methods.
This commit is contained in:
the_fiddler 2009-04-12 18:24:56 +00:00
parent 58faedc0fd
commit 8a0d494069
3 changed files with 4080 additions and 697 deletions

View file

@ -49,22 +49,22 @@ namespace Examples.Tutorial
GL.NormalPointer(NormalPointerType.Float, 0, shape.Normals); GL.NormalPointer(NormalPointerType.Float, 0, shape.Normals);
// Enable Light 0 and set its parameters. // Enable Light 0 and set its parameters.
GL.Lightv(LightName.Light0, LightParameter.Position, new float[] { 1.0f, 1.0f, -0.5f }); GL.Light(LightName.Light0, LightParameter.Position, new float[] { 1.0f, 1.0f, -0.5f });
GL.Lightv(LightName.Light0, LightParameter.Ambient, new float[] { 0.3f, 0.3f, 0.3f, 1.0f }); GL.Light(LightName.Light0, LightParameter.Ambient, new float[] { 0.3f, 0.3f, 0.3f, 1.0f });
GL.Lightv(LightName.Light0, LightParameter.Diffuse, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); GL.Light(LightName.Light0, LightParameter.Diffuse, new float[] { 1.0f, 1.0f, 1.0f, 1.0f });
GL.Lightv(LightName.Light0, LightParameter.Specular, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); GL.Light(LightName.Light0, LightParameter.Specular, new float[] { 1.0f, 1.0f, 1.0f, 1.0f });
GL.Lightv(LightName.Light0, LightParameter.SpotExponent, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); GL.Light(LightName.Light0, LightParameter.SpotExponent, new float[] { 1.0f, 1.0f, 1.0f, 1.0f });
GL.LightModelv(LightModelParameter.LightModelAmbient, new float[] { 0.2f, 0.2f, 0.2f, 1.0f }); GL.LightModel(LightModelParameter.LightModelAmbient, new float[] { 0.2f, 0.2f, 0.2f, 1.0f });
GL.LightModel(LightModelParameter.LightModelTwoSide, 1); GL.LightModel(LightModelParameter.LightModelTwoSide, 1);
GL.LightModel(LightModelParameter.LightModelLocalViewer, 1); GL.LightModel(LightModelParameter.LightModelLocalViewer, 1);
GL.Enable(EnableCap.Lighting); GL.Enable(EnableCap.Lighting);
GL.Enable(EnableCap.Light0); GL.Enable(EnableCap.Light0);
// Use GL.Material to set your object's material parameters. // Use GL.Material to set your object's material parameters.
GL.Materialv(MaterialFace.Front, MaterialParameter.Ambient, new float[] { 0.3f, 0.3f, 0.3f, 1.0f }); GL.Material(MaterialFace.Front, MaterialParameter.Ambient, new float[] { 0.3f, 0.3f, 0.3f, 1.0f });
GL.Materialv(MaterialFace.Front, MaterialParameter.Diffuse, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); GL.Material(MaterialFace.Front, MaterialParameter.Diffuse, new float[] { 1.0f, 1.0f, 1.0f, 1.0f });
GL.Materialv(MaterialFace.Front, MaterialParameter.Specular, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); GL.Material(MaterialFace.Front, MaterialParameter.Specular, new float[] { 1.0f, 1.0f, 1.0f, 1.0f });
GL.Materialv(MaterialFace.Front, MaterialParameter.Emission, new float[] { 0.0f, 0.0f, 0.0f, 1.0f }); GL.Material(MaterialFace.Front, MaterialParameter.Emission, new float[] { 0.0f, 0.0f, 0.0f, 1.0f });
} }
#endregion #endregion

File diff suppressed because it is too large Load diff

View file

@ -29,11 +29,11 @@ namespace OpenTK.Graphics.OpenGL.Enums
namespace OpenTK.Graphics namespace OpenTK.Graphics
{ {
/// <summary> /// <summary>
/// OpenGL binding for .NET, implementing OpenGL 2.1, plus extensions. /// OpenGL bindings for .NET, implementing OpenGL 3.1, plus extensions.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// <para> /// <para>
/// This class contains all OpenGL enums and functions defined in the 2.1 specification. /// This class contains all OpenGL enums and functions defined in the 3.1 specification.
/// The official .spec files can be found at: http://opengl.org/registry/. /// The official .spec files can be found at: http://opengl.org/registry/.
/// </para> /// </para>
/// <para> A valid OpenGL context must be created before calling any OpenGL function.</para> /// <para> A valid OpenGL context must be created before calling any OpenGL function.</para>
@ -652,28 +652,28 @@ namespace OpenTK.Graphics
#region public static void Material() overloads #region public static void Material() overloads
public static void Materialv(MaterialFace face, MaterialParameter pname, Vector4 @params) public static void Material(MaterialFace face, MaterialParameter pname, Vector4 @params)
{ {
Materialv(face, pname, ref @params.X); Material(face, pname, ref @params.X);
} }
public static void Materialv(MaterialFace face, MaterialParameter pname, Color4 @params) public static void Material(MaterialFace face, MaterialParameter pname, Color4 @params)
{ {
unsafe { GL.Materialv(face, pname, (float*)&@params); } unsafe { GL.Material(face, pname, (float*)&@params); }
} }
#endregion #endregion
#region public static void Light() overloads #region public static void Light() overloads
public static void Lightv(LightName name, LightParameter pname, Vector4 @params) public static void Light(LightName name, LightParameter pname, Vector4 @params)
{ {
GL.Lightv(name, pname, ref @params.X); GL.Light(name, pname, ref @params.X);
} }
public static void Lightv(LightName name, LightParameter pname, Color4 @params) public static void Light(LightName name, LightParameter pname, Color4 @params)
{ {
unsafe { GL.Lightv(name, pname, (float*)&@params); } unsafe { GL.Light(name, pname, (float*)&@params); }
} }
#endregion #endregion
@ -833,6 +833,81 @@ namespace OpenTK.Graphics
} }
} }
public static void UniformMatrix4(int location, int count, bool transpose, ref Matrix4 matrix)
{
unsafe
{
fixed (float* matrix_ptr = &matrix.Row0.X)
{
GL.UniformMatrix4(location, count, transpose, matrix_ptr);
}
}
}
#region Uniform
[CLSCompliant(false)]
public static void Uniform2(int location, ref Vector2 vector)
{
unsafe
{
fixed (float* vector_ptr = &vector.X)
{
GL.Uniform2(location, 2, vector_ptr);
}
}
}
[CLSCompliant(false)]
public static void Uniform2(int location, ref Vector3 vector)
{
unsafe
{
fixed (float* vector_ptr = &vector.X)
{
GL.Uniform3(location, 3, vector_ptr);
}
}
}
[CLSCompliant(false)]
public static void Uniform2(int location, ref Vector4 vector)
{
unsafe
{
fixed (float* vector_ptr = &vector.X)
{
GL.Uniform4(location, 4, vector_ptr);
}
}
}
public static void Uniform2(int location, Vector2 vector)
{
unsafe
{
GL.Uniform2(location, 2, &vector.X);
}
}
public static void Uniform2(int location, Vector3 vector)
{
unsafe
{
GL.Uniform3(location, 3, &vector.X);
}
}
public static void Uniform2(int location, Vector4 vector)
{
unsafe
{
GL.Uniform4(location, 4, &vector.X);
}
}
#endregion
#endregion #endregion
#region public static void ShaderSource(Int32 shader, System.String @string) #region public static void ShaderSource(Int32 shader, System.String @string)
@ -908,6 +983,7 @@ namespace OpenTK.Graphics
#region public static void VertexAttrib2(Int32 index, ref Vector2 v) #region public static void VertexAttrib2(Int32 index, ref Vector2 v)
[CLSCompliant(false)]
public static void VertexAttrib2(Int32 index, ref Vector2 v) public static void VertexAttrib2(Int32 index, ref Vector2 v)
{ {
GL.VertexAttrib2(index, v.X, v.Y); GL.VertexAttrib2(index, v.X, v.Y);
@ -917,6 +993,7 @@ namespace OpenTK.Graphics
#region public static void VertexAttrib3(Int32 index, ref Vector3 v) #region public static void VertexAttrib3(Int32 index, ref Vector3 v)
[CLSCompliant(false)]
public static void VertexAttrib3(Int32 index, ref Vector3 v) public static void VertexAttrib3(Int32 index, ref Vector3 v)
{ {
GL.VertexAttrib3(index, v.X, v.Y, v.Z); GL.VertexAttrib3(index, v.X, v.Y, v.Z);
@ -926,6 +1003,7 @@ namespace OpenTK.Graphics
#region public static void VertexAttrib4(Int32 index, ref Vector4 v) #region public static void VertexAttrib4(Int32 index, ref Vector4 v)
[CLSCompliant(false)]
public static void VertexAttrib4(Int32 index, ref Vector4 v) public static void VertexAttrib4(Int32 index, ref Vector4 v)
{ {
GL.VertexAttrib4(index, v.X, v.Y, v.Z, v.W); GL.VertexAttrib4(index, v.X, v.Y, v.Z, v.W);
@ -933,6 +1011,33 @@ namespace OpenTK.Graphics
#endregion #endregion
#region public static void VertexAttrib2(Int32 index, Vector2 v)
public static void VertexAttrib2(Int32 index, Vector2 v)
{
GL.VertexAttrib2(index, v.X, v.Y);
}
#endregion
#region public static void VertexAttrib3(Int32 index, Vector3 v)
public static void VertexAttrib3(Int32 index, Vector3 v)
{
GL.VertexAttrib3(index, v.X, v.Y, v.Z);
}
#endregion
#region public static void VertexAttrib4(Int32 index, Vector4 v)
public static void VertexAttrib4(Int32 index, Vector4 v)
{
GL.VertexAttrib4(index, v.X, v.Y, v.Z, v.W);
}
#endregion
#region public static void MultiTexCoord2(TextureUnit target, ref Vector2 v) #region public static void MultiTexCoord2(TextureUnit target, ref Vector2 v)
public static void MultiTexCoord2(TextureUnit target, ref Vector2 v) public static void MultiTexCoord2(TextureUnit target, ref Vector2 v)