zoukankan      html  css  js  c++  java
  • CsGL着色的三角形

    转自NeHe教程

    public override void Draw() {                                                    // Here's Where We Do All The Drawing
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);                            // Clear Screen And Depth Buffer
                glLoadIdentity();                                                            // Reset The Current Modelview Matrix
    
                glTranslatef(0.0f, 0.0f, -6.0f);                                            // Move Into The Screen 6.0
    
                glRotatef(angle, 0.0f, 1.0f, 0.0f);                                            // Rotate The Triangle On The Y Axis By angle
                for(rot1 = 0; rot1 < 2; rot1++) {                                            // 2 Passes For Two Sets Of Triangles
                    glRotatef( 90.0f, 0.0f, 1.0f, 0.0f);                                    // Rotate 90 Degrees On The Y-Axis
                    glRotatef(180.0f, 1.0f, 0.0f, 0.0f);                                    // Rotate 180 Degress On The X-Axis
                    for(rot2 = 0; rot2 < 2; rot2++) {                                        // 2 Passes For Each Of The Sets, Draw Two Triangles
                        glRotatef(180.0f, 0.0f, 1.0f, 0.0f);                                // Rotate 180 Degrees On The Y-Axis
                        glBegin(GL_TRIANGLES);                                                // Begin Drawing Triangles
                        glColor3f(1.0f, 0.0f, 0.0f);  glVertex3f( 0.0f,  1.0f, 0.0f);        // Draw The Red Vertex
                        glColor3f(0.0f, 1.0f, 0.0f);  glVertex3f(-1.0f, -1.0f, 1.0f);        // Draw The Green Vertex
                        glColor3f(0.0f, 0.0f, 1.0f);  glVertex3f( 1.0f, -1.0f, 1.0f);        // Draw The Blue Vertex
                        glEnd ();                                                            // Done Drawing Triangles
                    }
                }
    
                angle += 0.2f;                                                                // Update angle
                glFlush();                                                                    // Flush The GL Rendering Pipeline
            }
  • 相关阅读:
    FTP 协议和 HTTP 协议的比较
    HttpURLConnection的post请求,什么时候发出,writeData存在什么地方
    装饰器
    函数参数以及名称空间作用域
    函数的调用
    函数的返回值
    定义函数的三种方式
    函数
    day05
    day04
  • 原文地址:https://www.cnblogs.com/arxive/p/7004500.html
Copyright © 2011-2022 走看看