在此记录一下SharpGL最初创建的程序
在此记录一下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最初创建的程序的更多相关文章
- reinstall_xbt: Linux中如何查看文件的最初创建时间
Linux中如何查看文件的最初创建时间 与文件相关的几个时间: 1.访问时间,读一次这个文件的内容,这个时间就会更新.比如对这个文件使用more命令.ls.stat命令都不会修改文件的访问时间. ...
- Linux中如何查看文件的最初创建时间
查看 一个文件的 最初创建时间: Linux中如何查看文件的最初创建时间 linux 目前Linux没有直接查看创建文件的命令,你只能通过文件是否被修改过来进行判断. //查看代码stat ...
- 03 入门 - 安装MVC 5和创建应用程序
目录索引:<ASP.NET MVC 5 高级编程>学习笔记 本篇内容: 1. ASP.NET MVC 5的软件需求 2. 安装ASP.NET MVC 5 1)安装MVC 5开发组件 2)服 ...
- QT源码解析(一) QT创建窗口程序、消息循环和WinMain函数
QT源码解析(一) QT创建窗口程序.消息循环和WinMain函数 分类: QT2009-10-28 13:33 17695人阅读 评论(13) 收藏 举报 qtapplicationwindowse ...
- 微信小程序-创建小程序页面
QQ讨论群:785071190 创建页面 创建小程序页面非常简单,鼠标在需要创建页面的目录右击,可看到下图菜单,选择"Page"即可创建出一个页面. 输入页面名称,回车就可以创建出 ...
- Xcode创建Object-C程序
一. Xcode 环境安装 与 工程创建 1. 下载环境 相关资源下载 : -- IOS 相关资料下载页面 : https://developer.apple.com/devcenter/ios/i ...
- VS 2008 创建MFC程序对话框的步骤
用过不少编程语言,可是刚开始学的时候最容易忘记一些简单的流程或者生疏了.那么这里就说说VS 2008 创建MFC程序对话框的步骤.我主要是android开发方面的.平时使用jni调用不少c++代码.所 ...
- 如何创建C++程序
下载Microsoft Visual C++ 6.0请点击这里:VC 6.0下载(包括中文版英文版)(支持Win7和XP) 首先,我们要进入Microsoft Visual C++集成开发环境(Int ...
- 使用WiX Toolset创建.NET程序发布Bootstrapper(安装策略管理)(二)——自定义安装
原文:使用WiX Toolset创建.NET程序发布Bootstrapper(安装策略管理)(二)--自定义安装 自定义产品卸载方式 继续从上一次的基础上前进,现在我们已经知道了最简单的bootstr ...
随机推荐
- 时间“Thu Aug 14 2014 14:28:06 GMT+0800”的转换
var date = "Thu Aug 14 2014 14:28:06 GMT+0800"; var va = DateTime.ParseExact(date, "d ...
- 说说Statement、PreparedStatement和CallableStatement的异同(转)
1.Statement.PreparedStatement和CallableStatement都是接口(interface). 2.Statement继承自Wrapper.PreparedStatem ...
- SAP第一轮面试总结
1. 开始是一套面试题,可以选JAVA或C/C++两个语言的英文题.基础语法题,以指针为主. 2. 英文介绍,自由发挥.问了以下几个问题: 离职的愿意,未来五年的计划,介不介意使用ABAP langu ...
- C#之不借助第三变量交换两变量值
源码: 1 2 3 4 5 int n1=10, n2=20; n1 = n1 - n2; // -10 n2 = n1 + n2; // 10 n1 = n2 - n1 ...
- js之数据类型
1.数组类型 var Array=new Array(); 长度可变 var Array=new Array(n); 长度为n的数组 var Array=new Array("A" ...
- python第一天基础1-2
python入门 1 第一个python代码: 在linux上创建第一个.py脚本 #!/usr/bin/env python #-*- coding:utf-8 -*- print "He ...
- PHP 实现单一入口 apache配置
在apache的httpd.conf加入,需要把LoadModule rewrite_module modules/mod_rewrite.so前面的“#”去掉 DocumentRoot / < ...
- ORACLE 查询一个数据表后通过遍历再插入另一个表中的两种写法
ORACLE 查询一个数据表后通过遍历再插入另一个表中的两种写法 语法 第一种: 通过使用Oracle语句块 --指定文档所有部门都能查看 declare cursor TABLE_DEPT and ...
- (bzoj2330)糖果
2330: [SCOI2011]糖果 Time Limit: 10 Sec Memory Limit: 128 MB Description 幼儿园里有N个小朋友,lxhgww老师现在想要给这些小朋 ...
- eclipse 配色方案
http://www.blogjava.net/kuuyee/archive/2013/02/26/395728.html