返回顶部
首页 > 资讯 > 后端开发 > Python >3.光滑着色和平面着色
  • 867
分享到

3.光滑着色和平面着色

光滑平面 2023-01-31 03:01:16 867人浏览 八月长安

Python 官方文档:入门教程 => 点击学习

摘要

public void Color(double red, double green, double blue)         SharpGL.OpenGL 的成员                 private void op

public void Color(double red, double green, double blue)
        SharpGL.OpenGL 的成员
                private void openGLControl1_OpenGLDraw(object sender, PaintEventArgs e)
                {

                        //    Get the OpenGL object, just to clean up the code.
                        SharpGL.OpenGL gl = this.openGLControl1.OpenGL;

                        gl.Clear(OpenGL.COLOR_BUFFER_BIT | OpenGL.DEPTH_BUFFER_BIT);  // Clear The Screen And The Depth Buffer
                        gl.LoadIdentity();          // Reset The View
                        gl.Translate(-1.5f, 0.0f, -6.0f);        // Move Left And Into The Screen

                        gl.Begin(OpenGL.TRIANGLES);          // Start Drawing The Pyramid

                        gl.Color(1.0f, 0.0f, 0.0f);      // Red
                        gl.Vertex(0.0f, 1.0f, 0.0f);      // Top Of Triangle (Front)
                        gl.Color(0.0f, 1.0f, 0.0f);      // Green
                        gl.Vertex(-1.0f, -1.0f, 0.0f);      // Left Of Triangle (Front)
                        gl.Color(0.0f, 0.0f, 1.0f);      // Blue
                        gl.Vertex(1.0f, -1.0f, 0.0f);      // Right Of Triangle (Front)

                        gl.End();            // Done Drawing The Pyramid

                        gl.Translate(3f, 0.0f, 0.0f);        // Move Right And Into The Screen


                        gl.Begin(OpenGL.QUADS);          // Start Drawing The Cube

                        gl.Color(0.5f, 0.5f, 1.0f);      // Set The Color To Green
                        gl.Vertex(-1.0f, 1.0f, 0.0f);      // Top Right Of The Quad (Top)
                        gl.Vertex(1.0f, 1.0f, 0.0f);      // Top Left Of The Quad (Top)
                        gl.Vertex(1.0f, -1.0f, 0.0f);      // Bottom Left Of The Quad (Top)
                        gl.Vertex(-1.0f, -1.0f, 0.0f);      // Bottom Right Of The Quad (Top)


                        gl.End();            // Done Drawing The Q

                        gl.Flush();  
                }
 

--结束END--

本文标题: 3.光滑着色和平面着色

本文链接: https://lsjlt.com/news/187669.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作