在此记录一下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 ...
随机推荐
- module.export和export
module.exports 和 exports 是引用到的同一个对象,类似下面代码所示(为了举例,不是完全的正确): var module.exports = {}; var expo ...
- 格式化HRESULT获取对应文本
CString CXXUtil::FormatMessageFor(HRESULT hr) { CString strMsg; LPVOID pvMsgBuf = NULL; LPCTSTR pszM ...
- CodeSmith Generator 7.0.2激活步骤
地址是:http://www.cnblogs.com/dunitian/p/4096917.html
- linux下的device tree
在我个人的理解,device tree就是描述硬件设备的,目前有什么配置,把这些配置信息告诉linux内核,让内核去识别,增强了内核的通用性,不用因为平台不同而每次都要编译新内核了. 配置device ...
- 在线编辑器的使用-KindEditor
第一种:KindEditor编辑器 步骤一:加载相应的核心的文件 下载地址:http://kindeditor.net/demo.php <link rel="stylesheet&q ...
- Dancing Links & Algorithm X
1 参考链接 http://www.cnblogs.com/steady/archive/2011/03/15/1984791.html#undefined http://en.wikipedia.o ...
- HDU 1575
Tr A Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...
- 猜字符游戏之java
package days06; //需求......,问题,为什么要用do{}while???import java.util.Scanner;public class RepeatOfGussing ...
- ngixn编译安装时,pcre的处理
nginx编译时pcre会提示找不到libpcre.so.1 ./configure --hlep --without-pcre disable PCRE library usage 不使用pcr ...
- markDown使用
Markdown快速入门 基本语法 1.标题 使用"#"来表示标题的级别,个数越少,标题级别越高 2.段落和换行 使用这个标志来生成段落 在行末输入2个或者以上的空格再回车就可以换 ...