首页 > 代码库 > CsGL着色的三角形
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 }
CsGL着色的三角形
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。