在此记录一下SharpGL最初创建的程序。完整工程在此

 /// <summary>
/// The main form class.
/// </summary>
public partial class SharpGLForm : Form
{
/// <summary>
/// Initializes a new instance of the <see cref="SharpGLForm"/> class.
/// </summary>
public SharpGLForm()
{
InitializeComponent();
} /// <summary>
/// Handles the OpenGLDraw event of the openGLControl control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param>
private void openGLControl_OpenGLDraw(object sender, PaintEventArgs e)
{
// Get the OpenGL object.
OpenGL gl = openGLControl.OpenGL; // Clear the color and depth buffer.
gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT); // Load the identity matrix.
gl.LoadIdentity(); // Rotate around the Y axis.
gl.Rotate(rotation, 0.0f, 1.0f, 0.0f); // Draw a coloured pyramid.
gl.Begin(OpenGL.GL_TRIANGLES);
gl.Color(1.0f, 0.0f, 0.0f);
gl.Vertex(0.0f, 1.0f, 0.0f);
gl.Color(0.0f, 1.0f, 0.0f);
gl.Vertex(-1.0f, -1.0f, 1.0f);
gl.Color(0.0f, 0.0f, 1.0f);
gl.Vertex(1.0f, -1.0f, 1.0f);
gl.Color(1.0f, 0.0f, 0.0f);
gl.Vertex(0.0f, 1.0f, 0.0f);
gl.Color(0.0f, 0.0f, 1.0f);
gl.Vertex(1.0f, -1.0f, 1.0f);
gl.Color(0.0f, 1.0f, 0.0f);
gl.Vertex(1.0f, -1.0f, -1.0f);
gl.Color(1.0f, 0.0f, 0.0f);
gl.Vertex(0.0f, 1.0f, 0.0f);
gl.Color(0.0f, 1.0f, 0.0f);
gl.Vertex(1.0f, -1.0f, -1.0f);
gl.Color(0.0f, 0.0f, 1.0f);
gl.Vertex(-1.0f, -1.0f, -1.0f);
gl.Color(1.0f, 0.0f, 0.0f);
gl.Vertex(0.0f, 1.0f, 0.0f);
gl.Color(0.0f, 0.0f, 1.0f);
gl.Vertex(-1.0f, -1.0f, -1.0f);
gl.Color(0.0f, 1.0f, 0.0f);
gl.Vertex(-1.0f, -1.0f, 1.0f);
gl.End(); // Nudge the rotation.
rotation += 3.0f;
} /// <summary>
/// Handles the OpenGLInitialized event of the openGLControl control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void openGLControl_OpenGLInitialized(object sender, EventArgs e)
{
// TODO: Initialise OpenGL here. // Get the OpenGL object.
OpenGL gl = openGLControl.OpenGL; // Set the clear color.
gl.ClearColor(, , , );
} /// <summary>
/// Handles the Resized event of the openGLControl control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void openGLControl_Resized(object sender, EventArgs e)
{
// TODO: Set the projection matrix here. // Get the OpenGL object.
OpenGL gl = openGLControl.OpenGL; // Set the projection matrix.
gl.MatrixMode(OpenGL.GL_PROJECTION); // Load the identity.
gl.LoadIdentity(); // Create a perspective transformation.
gl.Perspective(60.0f, (double)Width / (double)Height, 0.01, 100.0); // Use the 'look at' helper function to position and aim the camera.
gl.LookAt(-, , -, , , , , , ); // Set the modelview matrix.
gl.MatrixMode(OpenGL.GL_MODELVIEW);
} /// <summary>
/// The current rotation.
/// </summary>
private float rotation = 0.0f;
}

在此记录一下SharpGL最初创建的程序的更多相关文章

  1. reinstall_xbt: Linux中如何查看文件的最初创建时间

    Linux中如何查看文件的最初创建时间 与文件相关的几个时间: 1.访问时间,读一次这个文件的内容,这个时间就会更新.比如对这个文件使用more命令.ls.stat命令都不会修改文件的访问时间.   ...

  2. Linux中如何查看文件的最初创建时间

    查看 一个文件的 最初创建时间: Linux中如何查看文件的最初创建时间  linux     目前Linux没有直接查看创建文件的命令,你只能通过文件是否被修改过来进行判断. //查看代码stat  ...

  3. 03 入门 - 安装MVC 5和创建应用程序

    目录索引:<ASP.NET MVC 5 高级编程>学习笔记 本篇内容: 1. ASP.NET MVC 5的软件需求 2. 安装ASP.NET MVC 5 1)安装MVC 5开发组件 2)服 ...

  4. QT源码解析(一) QT创建窗口程序、消息循环和WinMain函数

    QT源码解析(一) QT创建窗口程序.消息循环和WinMain函数 分类: QT2009-10-28 13:33 17695人阅读 评论(13) 收藏 举报 qtapplicationwindowse ...

  5. 微信小程序-创建小程序页面

    QQ讨论群:785071190 创建页面 创建小程序页面非常简单,鼠标在需要创建页面的目录右击,可看到下图菜单,选择"Page"即可创建出一个页面. 输入页面名称,回车就可以创建出 ...

  6. Xcode创建Object-C程序

    一. Xcode 环境安装 与 工程创建 1. 下载环境 相关资源下载 : -- IOS 相关资料下载页面 :  https://developer.apple.com/devcenter/ios/i ...

  7. VS 2008 创建MFC程序对话框的步骤

    用过不少编程语言,可是刚开始学的时候最容易忘记一些简单的流程或者生疏了.那么这里就说说VS 2008 创建MFC程序对话框的步骤.我主要是android开发方面的.平时使用jni调用不少c++代码.所 ...

  8. 如何创建C++程序

    下载Microsoft Visual C++ 6.0请点击这里:VC 6.0下载(包括中文版英文版)(支持Win7和XP) 首先,我们要进入Microsoft Visual C++集成开发环境(Int ...

  9. 使用WiX Toolset创建.NET程序发布Bootstrapper(安装策略管理)(二)——自定义安装

    原文:使用WiX Toolset创建.NET程序发布Bootstrapper(安装策略管理)(二)--自定义安装 自定义产品卸载方式 继续从上一次的基础上前进,现在我们已经知道了最简单的bootstr ...

随机推荐

  1. sqlite3 根据实体自动生成建表语句

      public class BuildSqlTool { public static string GetCreateTableSql(object t) { //CREATE TABLE &quo ...

  2. win10 EFI装ubuntu14.04双系统 及初始配置

    这次第二次装ubuntu系统了,第一次是在win7下安装的,到了win10,由于用了efi,跟win7的安装方法不太相同,相同点有: 1.仍然可以用u盘启动,我用的是UltroISO这个软件. 2.装 ...

  3. 性能测试之--Apache JMeter安装

    Hi,今天给大家分享一下安装JMeter的相关内容~ Apache JMeter 是Apache组织的开源项目,是一个100%纯Java桌面应用,用于压力测试和性能测试. 它能够对HTTP.FTP服务 ...

  4. react 15来了

    有段时间没做react的项目了,前两天才发现react搞了一个不太小的动作,不是遵循原来的小版本号迭代,从0.14.x继续更新,而是直接跳到了15.0.X.虽然业界一直有这个观点,0.x的版本视为非稳 ...

  5. Codeforces #380 div2 B(729B) Spotlights

    B. Spotlights time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  6. Windows 10开机的秘密在哪里

    如何查看开机速度 查看开机速度,一定要安装所谓的第三方安全软件么?老子就是不喜欢被安全! Windows自带的事件查看器中记录了系统的一举一动,何必需要别人来监视? 在运行(WinKey+R)中输入e ...

  7. 父窗口window.showModalDialog传值 子窗口window.returnValue返回值

    父窗口打开子窗口页面: var fatherWindow = document.all.dealReason;//想传的值 win = window.showModalDialog(strUrl, f ...

  8. 第53讲:Scala中结构类型实战详解

    今天学习了scala的结构类型,让我们看看代码 class Structural {def open() = print("A class interface opened") } ...

  9. Python成长笔记 - 基础篇 (八)

    socket编程 应用层: 表示层: 会话层: 传输层: 网络层: ip地址 数据链路层: MAC地址 物理层:   协议类型: TCP/IP协议:三次握手,四次断开     2. Socket 参数 ...

  10. java-集合类

    框架图 集合类 面向对象语言对事物的体现都是以对象的形式,所以为了方便对多个对象的操作,就对对象进行存储,集合就是存储对象最常用的一种方式.数组和集合类同是容器,有何不同?数组存储同一类型的基本数据类 ...