3.立方体和旋转
来源:互联网 发布:php购物车功能怎么实现 编辑:程序博客网 时间:2024/05/22 06:27
static void Main(string[] args) { GameWindow game = new GameWindow(); game.Load += (sender, e) => { // setup settings, load textures, sounds game.VSync = VSyncMode.On; GL.ClearColor(System.Drawing.Color.MidnightBlue); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); GL.Viewport(0, 0, game.Width, game.Height); //GL.Viewport(this.ClientRectangle); GL.MatrixMode(MatrixMode.Projection); Matrix4 proj = Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4, game.ClientRectangle.Width / (float)game.ClientRectangle.Height, 1.0F, 100F); GL.LoadMatrix(ref proj); }; game.Resize += (sender, e) => { GL.Viewport(0, 0, game.Width, game.Height); //GL.Viewport(this.ClientRectangle); GL.MatrixMode(MatrixMode.Projection); Matrix4 proj = Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4, game.ClientRectangle.Width / (float)game.ClientRectangle.Height, 1.0F, 100F); GL.LoadMatrix(ref proj); }; game.UpdateFrame += (sender, e) => { // add game logic, input handling if (game.Keyboard[Key.Escape]) { game.Exit(); } if (game.Keyboard[Key.Enter]) { if (game.WindowState == WindowState.Fullscreen) { game.WindowState = WindowState.Normal; } else { game.WindowState = WindowState.Fullscreen; } } }; game.RenderFrame += (sender, e) => { GL.ClearColor(Color.SkyBlue); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); Matrix4 modelView = Matrix4.LookAt(new Vector3(0.0F, 5.0F, 10.0F), Vector3.Zero, Vector3.UnitY); GL.MatrixMode(MatrixMode.Modelview); GL.LoadMatrix(ref modelView); // GL.Rotate(_angle * 0.18F / (float)Math.PI, Vector3.One); GL.Color4(Color.FromArgb(100, Color.Red)); GL.Begin(BeginMode.Triangles); int i = 0; foreach (var index in _cube.Indices) { switch (i%6) { case 0: GL.Color3(Color.MidnightBlue); break; case 1: GL.Color3(Color.SpringGreen); break; case 2: GL.Color3(Color.YellowGreen); break; case 3: GL.Color3(Color.YellowGreen); break; case 4: GL.Color3(Color.SpringGreen); break; case 5: GL.Color3(Color.OrangeRed); break; default: GL.Color3(Color.Ivory); break; } i++; GL.Vertex3(_cube.Vertices[index]); } GL.End(); // _angle++; game.SwapBuffers(); }; game.Run(); }
0 0
- 3.立方体和旋转
- OpenGL显示中文和旋转立方体贴图
- 一个旋转立方体和以立方体为目标的旋转相机
- O3D 例2- 立方体的移动、缩放和旋转
- O3D 例2- 立方体的移动、缩放和旋转
- 旋转的立方体
- 3D 旋转立方体
- 旋转的四个立方体
- HTML5旋转立方体
- ios立方体旋转动画
- CSS3嵌套立方体旋转
- 旋转立方体相册
- HTML5,CSS3 旋转立方体
- OpenGL-绘制旋转立方体
- OpenGL绘制旋转立方体实例
- wpf 3D立方体旋转
- OpenGL绘制旋转立方体实例
- 3D旋转立方体演示
- 在virtualbox+centOS下安装Python的全步骤和注意事项
- 杭电OJ 第一周 ProblemF:气球颜色
- 通过JSP转化成word并下载
- openerp QWeb
- Unable to boot the iOS Simulator
- 3.立方体和旋转
- 一、mongodb集群管理增删节点
- 如何得到一个数的个、十、百、千位数
- javascript页面左下角的走马灯效果
- zookeeper分布式锁(九)
- FastDFS概述
- 字符编码笔记:ASCII,Unicode和UTF-8
- 函数调用与堆栈的变化
- mysql基本配置