本文整理汇总了C#中OpenGL.MultMatrix方法的典型用法代码示例。如果您正苦于以下问题:C# OpenGL.MultMatrix方法的具体用法?C# OpenGL.MultMatrix怎么用?C# OpenGL.MultMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenGL
的用法示例。
在下文中一共展示了OpenGL.MultMatrix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateProjectionMatrix
/// <summary>
/// Creates the projection matrix for the given screen size.
/// </summary>
/// <param name="gl">The OpenGL instance.</param>
/// <param name="screenWidth">Width of the screen.</param>
/// <param name="screenHeight">Height of the screen.</param>
public void CreateProjectionMatrix(OpenGL gl, float screenWidth, float screenHeight)
{
// Create the projection matrix for our screen size.
const float S = 0.46f;
float H = S * screenHeight / screenWidth;
projectionMatrix = glm.pfrustum(-S, S, -H, H, 1, 100);
// When we do immediate mode drawing, OpenGL needs to know what our projection matrix
// is, so set it now.
gl.MatrixMode(OpenGL.GL_PROJECTION);
gl.LoadIdentity();
gl.MultMatrix(projectionMatrix.to_array());
gl.MatrixMode(OpenGL.GL_MODELVIEW);
}
示例2: TransformMatrix
/// <summary>
/// This is the class' main function, to override this function and perform a
/// perspective transformation.
/// </summary>
public void TransformMatrix(OpenGL gl)
{
gl.MultMatrix(transformMatrix.AsColumnMajorArray);
}
示例3: RenderImmediateMode
/// <summary>
/// Renders the scene in immediate mode.
/// </summary>
/// <param name="gl">The OpenGL instance.</param>
public void RenderImmediateMode(OpenGL gl)
{
// Setup the modelview matrix.
gl.MatrixMode(OpenGL.GL_MODELVIEW);
gl.LoadIdentity();
gl.MultMatrix(modelviewMatrix.to_array());
// Push the polygon attributes and set line mode.
gl.PushAttrib(OpenGL.GL_POLYGON_BIT);
gl.PolygonMode(FaceMode.FrontAndBack, PolygonMode.Lines);
// Render the trefoil.
var vertices = trefoilKnot.Vertices;
gl.Begin(BeginMode.Triangles);
foreach (var index in trefoilKnot.Indices)
gl.Vertex(vertices[index].x, vertices[index].y, vertices[index].z);
gl.End();
// Pop the attributes, restoring all polygon state.
gl.PopAttrib();
}