1.Windows.Forms + GLControl
来源:互联网 发布:吉卜工作室 知乎 编辑:程序博客网 时间:2024/05/22 05:35
第一次开发opengl,本文介绍在windowsform下通过使用glcontrol进行开发的例子,最终结果是显示一个蓝底的窗体和一个黄色的三角形。
1.绘制蓝底的窗体
GL.ClearColor(Color.SkyBlue);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
glControl1.SwapBuffers();//交换缓冲区以在前台显示
2.设置绘图窗口投影
private void SetupViewport() { int w = glControl1.Width; int h = glControl1.Height; GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity(); GL.Ortho(0, w, 0, h, -1, 1); // Bottom-left corner pixel has coordinate (0, 0) GL.Viewport(0, 0, w, h); // Use all of the glControl painting area }
3.绘制三角形
GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity(); GL.Color3(Color.Yellow); GL.Begin(BeginMode.Polygon); GL.Vertex2(10, 20); GL.Vertex2(100, 20); GL.Vertex2(100, 50); GL.Vertex2(20, 100); GL.End();
0 0
- 1.Windows.Forms + GLControl
- Windows Forms 1.x 批判
- Windows Forms简介
- Windows Forms简介
- 体验Windows Forms
- Windows Forms RichTextBox
- System.Windows.Forms.Cursor
- Windows Forms简介
- Windows Forms in Action
- Windows Forms是什么?
- C Sharp Windows Forms
- windows + forms 混合 Authentication
- Windows.Forms.ImageLayout
- Windows Forms 数据绑定
- Windows Forms 多线程用户界面
- Windows Forms 多线程用户界面
- Windows Forms 多线程用户界面
- Windows Forms 键盘事件
- hibernate的优化-懒加载(lazy)----张国亮总结心得第二季
- 关于链接失败 对xxxx ‘__gxx_personality_v0’未定义的引用
- 企业应用软件如何借鉴电商软件的优点
- php 汉字转拼音类
- npm 安装 Express4.0版本的问题
- 1.Windows.Forms + GLControl
- 如何查看iphone手机证书和删除 Provesioning Profiles
- 《数据结构》第七章 查找技术 思维导图
- C++的error LNK2019: 无法解析的外部符号编译错误
- 高并发ConcurrentHashMap使用注意事项
- 论坛申请网站实名认证的条件?
- 【ExtJS】定义枚举类型的store
- 计算机顶级会议Rankings
- Android 之开发环境使用笔记