本文整理汇总了C#中SharpGL.OpenGL.LookAt方法的典型用法代码示例。如果您正苦于以下问题:C# OpenGL.LookAt方法的具体用法?C# OpenGL.LookAt怎么用?C# OpenGL.LookAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpGL.OpenGL
的用法示例。
在下文中一共展示了OpenGL.LookAt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(OpenGL renderer)
{
renderer.MatrixMode(SharpGL.Enumerations.MatrixMode.Modelview);
renderer.LookAt(_eye.X * Radius, _eye.Y * Radius, _eye.Z * Radius, _center.X * Radius, _center.Y * Radius, _center.Z * Radius, _up.X, _up.Y, _up.Z);
renderer.Translate(_position.X, _position.Y, _position.Z);
}
示例2: BasicResize
//utilities
public static void BasicResize(OpenGL _context, Size _size)
{
//ThrowIfNull(_context);
// Set the projection matrix.
_context.MatrixMode(OpenGL.GL_PROJECTION);
// Load the identity.
_context.LoadIdentity();
// Create a perspective transformation.
_context.Perspective(60.0f, _size.Width / _size.Height, 0.01, 100.0);
// Use the 'look at' helper function to position and aim the camera.
_context.LookAt(0, 0, 2, 0, 0, 0, 0, 1, 0);
// Set the modelview matrix.
_context.MatrixMode(OpenGL.GL_MODELVIEW);
}
示例3: openGLControl_OpenGLDraw
private void openGLControl_OpenGLDraw(object sender, RenderEventArgs e)
{
_gl = openGLControl.OpenGL;
_gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
_gl.LoadIdentity();
_gl.LookAt(0, 0, _w, 0, 0, 0, 0, 1, 0); //-10, 10, _w, 0, 0, 0, 0, 1, 0
_gl.Rotate((float)_rotX, (float)_rotY, (float)_rotZ);
_gl.Translate(_transX, _transY, _transZ);
foreach (Polygon polygon in _polygons)
{
if (!polygon.IsEnabled) continue;
polygon.PushObjectSpace(_gl);
polygon.Render(_gl, SharpGL.SceneGraph.Core.RenderMode.Render);
polygon.PopObjectSpace(_gl);
}
}
示例4: Resized
//Handles the Resized event of the openGLControl1 control
private void Resized(ref OpenGL gl, double Width, double Height)
{
// Set the projection matrix.
gl.MatrixMode(OpenGL.GL_PROJECTION);
// Load the identity.
gl.LoadIdentity();
if (!TexturesInitialised)
{
gl.Ortho(-1, 1, -1, 1, -1, 1);
}
else
{
gl.Ortho(0, gImage1.Width, gImage1.Height, 0, -1, 1);
}
gl.MatrixMode(OpenGL.GL_MODELVIEW);
gl.Disable(OpenGL.GL_DEPTH_TEST);
// Create a perspective transformation.
gl.Perspective(45.0f, (double)Width / (double)Height, 1.0, 1000.0);
gl.Viewport(0, 0, (int)Width, (int)Height);
// Use the 'look at' helper function to position and aim the camera.
gl.LookAt(-5, 5, -5, 0, 0, 0, 0, 1, 0);
// Set the modelview matrix.
gl.MatrixMode(OpenGL.GL_MODELVIEW);
}
示例5: SetCam
public static void SetCam(OpenGL gl)
{
gl.Perspective(60.0f, Aspect, 0.01, 100.0);
gl.LookAt(_x, _y, 30, _x, _y, 0, 0, 1, 0);
}