Computer Graphics




期末成績(公告三天,將於本星期五送出成績。目前可以修訂的僅有期末考,可至助教處(4208, 翁助教)看是否有更改錯誤,其餘分數不會改變)

Select one of the project below as your term project:

project 2

project 3

    orangefish.gif; purple.gif; bluefish.gif; greenfish.gif; purdue.gif; host.gif; hidden.gif

project 4

    dragon1.txt; dragon2.txt; dragon3.txt;

project 5

週數 Course Notes Python Notes Python Program Assignment



Syllabus in Purdue CS177, 2013 by Prof. Hoffmann


1. Computer Graphics Programming: Computer Science, Algorithm, Memory Size, Python basic



How to install Python. by 江清水

Problem Assignment 1 by 江清水


如何看Problem Assignment的Solution by 江清水

Solution for Problem Assignment 1 by 江清水



HW: 定義函數F2C(f)將華氏溫度f換算成攝氏溫度。





2. Input, Variables, Assignment, Expression, Output, Python Type


Problem Assignment 2 by 江清水

Solution for Problem Assignment 2 by 江清水

HW: 計算兩正整數的GCD



  3. Local/global variables, function, parameters, Precedence


project 1 from Purdue University (Exercise for students)

Problem Assignment 3 by 江清水

Solution Assignment 3 by 江清水

project 2 from Purdue University





2D Coordinate Geometry. [PPT][Word] by 江清水 4. Boolean, While, If .. Else

project 3 from Purdue University

project 4 from Purdue University

Porblem Assignment 4 by 江清水



2D Viewing Operations. [PPT][Word] by 江清水

5. List, for, String, Sequence


project 5 from Purdue University





  6. Library Problem Assignment 5 by 江清水 (posted on Oct. 7, 2:10Pm)

Solution Assignment 5 by 江清水


Curves by 江清水 7. Review

8. Data Structure: List, Tree

Problem Assignment 6: File input and output (posted on Nov 4, 2:10) by 江清水

input file for Problem 6 by 江清水



  9. File I/O, Trees

Problem Assignment 7: Image Processing (PIL Module)  by 江清水

input file for problem 7:  by 江清水



  10. Tree and Recursion Problem Assignment 8: File input and output (posted on Nov 4, 2:10) by 江清水

input file for Problem 8 by 江清水

Solution for Problem 8 by 江清水

Image Process





Problem Assignment 9: Image Processing (PIL Module) by 江清水

input file for problem 9 by 江清水

Solution for Problem 9 by 江清水

Loop Review






Problem 13: Draw a circle by using OpenGL module. by 江清水

Solution for Problem 13. by 江清水 





Problem 14: Animation: ball moving in a box.  (reference from

Solution for Problem 14. by 江清水



Surface by 江清水   Problem 15: Light and Material by 江清水 和 張修維

Solution for Problem 15 by 江清水





12:10-12:20 報告學生輸入PPT檔案,程式檔案

12:20-12:35 /1

12:35-12:50 /2

12:50-1:05 /3: 十五 (proj5)

1:05-1:20 /4: 十六 (proj 5)

1:20-1:35 /5: 一 (proj 3)

1:35-1:50 /6:二 (proj 4)

1:50-2:00     休息。報告學生輸入PPT檔案,程式檔案

2:00-2:15 /7: 十九 (proj 4)

2:15-2:30 /8: 十二 (proj 4)

2:30-2:45 /9: 七 (proj 4)

2:45-3:00 /10: 十七 (proj 3)

3:00-3:15 /11: 三 (proj 4)

3:15-3:30 /12: 十 (proj 3)

3:30-3:45 /13: 二十 (proj 4)

3:45-3:55     休息。報告學生輸入PPT檔案,程式檔案

3:55-4:10 /14: 十八 (proj 4)

4:10-4:25 /15: 八 (proj 2)

4:25-4:40 /16: 十三 (proj 2)

4:40-4:55 /17: 十一 (proj 4)

4:55-5:10 /18: 十四 (proj 4)

5:10-5:25 /19: 九 (proj 5)

5:25-5:40 /20: 四 (proj 5)




A History of Photography From Web (Cherokee County Schools)

Camara from Joe Collins

Photography (

Camara from Joe Collins

Computer Graphics and Its Application. [PPT][Word] by 江清水




The newest version of OpenGL. OpenGL 4.3, release on 8/6/2012. (網路英文資料)

OpenGL Books. (網路英文資料)



OpenGL 0: How to include the slut.h in visual C++? [PPT][Word] by 許伶潁

This chapter tells you how to include the slut.h into visual C++, ......


OpenGL 1: Your first simple program "simple.c". [simple.c by Angel][PPT files by Yi-Min Kuo][simple.JPG]

In this program, you learn how to open a window, draw a square in the window using the following GL and GLUT functions:

    glClear, glBegin, glEnd, glFlush

    glutCreateWindow, glutDisplayFunc, glutMainLoop


What is Sierpinski Gasket?

3D Coordinate System. [PPT][Word] by 江清水

OpenGL 2: A Demo Program to show you OpenGL features including smooth shading, antialiasing, texture mapping, color interpolation.     [demo.c by Angel][demo.JPG]

It is a demo program. All of the OpenGL (glut) features will be illustrated more detail in the future class.


OpenGL 3-6: Sierpinski Gasket. There are 3 programs for Sierpinski Gasket, including:

(1) 2D Sierpinski Gasket generated using randomly selected Vertices and bisection. [gasket.c by Angel][gasket.JPG]

(2) Recursive subdivision of triangle to form Sierpinske gasket. [gasket2.c by Angel][gasket2.JPG]

(3) 3D Sierpinski Gasket GL program. [gasket3D.c by Angel][gasket3d.JPG]

(4) Recursive subdivision of tetrahedron to form 3D Sierpinski Gasket. [tetra.c by Angel][tetra.JPG]

You learn the following GL and GLUT functions:

(1) glClearColor, glColor, glMatrixMode, glLoadIdentity, glOrtho2D

         glutInit, glutInitDisplayMode, glutInitWindowPosition

(2) No new function.

(3) glOrtho

      glutIdleFunc, glutMouseFunc

(4) glNormal, glViewport, glEnable

     glutPostRedisplay, glutReshapeFunc

You also learn recursive techniques in (2),  how to use mouse with OpenGL to start and stop program execution in (3), how to avoid the distortion in the window in (4).  

There are references for Sierpinski Gasket on the web. I recommend the one by Paul Baurke for our undergraduate student.

    Introduction to OpenGl Functions.

OpenGL 7: Earth. THis is a program to demo the use of quad strips and triangle fans for modeling a sphere by longitude and latitiude. You should know how to parameterize a sphere. [earth.c by Angle][earth.JPG][PPT by Yi-Min Kuo]

      Library functions: glrotate, glPolygonMode;



OpenGL 8: Square. The program illustrates the use of the glut library for interfacing with a Window System. [square.c by Angle][square.JPG][PPT by Yi-Min Kuo]

       Library function: glutMotionFunc;



OpenGL 9: Double buffer. Why we need the double buffering? How to handle the animation using OpenGL? This program with chapter 1 of the OpenGL Programming Guide gives you detail explanation. [double.c from Silicon Graphics][double.JPG]


OpenGL 10: Lines and lines stipple. This program demonstrates geometric primitives and their attributes, especially the line and line stipples. Please read the Chapter 2 of the OpenGL Programming Guide. [lines.c from Silicon Graphics][lines.JPG]



OpenGL 11: Polygon stippling. This program demonstrates polygon stippling. Please read the Chapter 2 of the OpenGL Programming Guide. [polys.c from Silicon Graphics][polys.JPG]



OpenGL 12: Model Transformation and Viewing Transformation. The program demonstrates modeling transformation glScalef() and viewing transformation gluLookAt(). [cube.c from Silicon Graphics][cube.JPG]

    Library Function: glScalef, glMatrixMode, glFrustum; gluLookAt; glutWireCube. 




OpenGL 13: Model Transformation. This program demonstrates modeling transformations. [model.c from Silicon Graphics][model.JPG]


OpenGL 14: Single buffer and double buffer. This program will show two windows at the same time with single buffer and double buffer used. [single_double.c by Angle][single_double.JPG]

    Library Function: glPushAttrib, glPopAttrib, glRasterPos.



OpenGL 15: New Paints. This program teach us how to design a simple tools bar. Let user have interaction with OpengGL program. [newpaint.c][newpaint.JPG][PPT by Yi-Min Kuo]

    Library Function: glutBitmapCharacter, glutBitmapWidth, glutCreateMenu, glutAddMenuEntry, glutAttachMenu, glutAddSubMenu.


OpenGL 16: Shadow. This program draws a polygon and its shadow. [shadow.c by Angle][shadow.JPG]


OpenGL 17: Sphere. This program show the display of sphere in three modes: wire frame, constant, and interpolative shading. [sphere.c by Angle][sphere.JPG]


OpenGL 18: Smooth-Shaded Triangle. This program is drawing a triangle with smooth model color. [smooth.c][smooth.JPG]

     Library Function: glShadeModel.


OpenGL 19: Using glColorMaterial. This is an interactive program that uses glColorMaterial() to change material parameters. Pressing each of the three mouse buttons changes the color of the diffuse reflection. [colormat.c][colormat.JPG]

    Library Function: glColorMaterial, glMaterial.


OpenGL 20: A Simple Bezier Curve. The program draws a cubic Bezier curve using four control points.[bezcurve.c][bezcurve.JPG]

    Library Function: glMap1, glEvalCoord.


OpenGL 21: Curves. This is a simple interactive curve drawing program. [curves.c by Angel][curves.JPG]

    Library Function: glMapGrid, glEvalMesh.


OpenGL 22: Read Pixels. This program reads pixels values from display and prints out RGB. [readpixels.c by Angel][readpixels.JPG]

    Library Function: glRect, glReadPixels, glReadBuffer, glPixelStore.



OpenGL 23: Blending. Blend colors to achieve such effects as making objects appear translucent. [alpha.c from Redbook][alpha.JPG]

    Library Function: glBlendFunc;


OpenGL 24: Three-Dimensional Blending: [alpha3D.c from Redbook][alpha3D.JPG]

    Library Function: glEnable, glGenLists, glNewList, glutSolidSphere, glEndList



OpenGL 25: Use the accumulation buffer to do full-scene antialiasing on a scene with orthographic parallel projection.[accanti.c][accanti.JPG]

    Library Function: glMaterial, glLight, glLightModel, ShadeModel, glClearAccum,

OpenGL 26: Antipoly. This program draws filled polygons with antialiased edges. [aapoly.c][aapoly.JPG]

    Library Function: glCullFace, glBlendFunc



OpenGL 27: Fog. This program draws 5 red spheres, each at a different z distance from the eye, in different types of fog. Pressing the f key chooses between 3 types of  fog: exponential, exponential squared, and linear.[fog.c][fog.JPG]

    Library Function: glFog, glHint,


OpenGL 28: Fogindex. This program draws 5 wireframe spheres, each at a different z distance from the eye, in linear fog.[fogindex.c]

    Library Function: glutSetColor, glClearIndex

十七   學生期末報告  



  1/3 1/10
3:30 第一組 建築物製作(10/4)

PPT    Menu   視訊1 視訊2

第十組 電玩遊戲立體人物模組(10/4)

PPT   圖片1 圖片2  圖片3

3:45 第二組 卡通人臉繪製(10/4)

PPT    Menu   Program   視訊

第十一組 利用Sketchup建置室內設計圖(10/4)

PPT   Menu   Program1   Program2

4:00 第三組 LOGO設計(10/11)

PPT    Menu   Program

第十二組 3D模型建構與控制-人形模組(10/4)

PPT   Menu   Program

4:15 第四組 機器人動畫(10/11)

PPT   Menu   Program

第十三組 遊戲的物理學

PPT   Menu   Program

4:30 休息十分鐘。請勿吵到其他班級上課
4:40 第五組 Plane game with VB(10/4)

PPT    Menu   Program   Demo



4:55 第六組 小精靈遊戲(10/11)

PPT   Menu   Program 

第十四組   國旗妙妙妙(10/4)

PPT   Program

5:10 第七組 動畫電影製作探討(10/4)


第十五組   多拉A夢2D圖(10/4)

PPT   視訊

5:25 第八組 全自動區分計算機和人類的圖靈測試(10/4)

PPT   Menu   Program

第十六組   360度全景攝影探討(10/11)


5:40 休息十分鐘。請勿吵到其他班級上課
5:50 第九組 機器人打籃球(10/4)

PPT    Menu   Program   Demo

6:05 教師講評 教師講評



OpenGL Notes

The teaching course in SIGGRAPH in 2001 by Shreiner, Angel and Shreiner. [Contents][Notes]




Assignment 1: This OpenGL program assignment is due on October 3, 2006.

Assignment 2: This OpenGL program assignment is due on November 7, 2006.

Assignment 3: This OpenGL program assignment is due on December 12, 2006.




Student Gallery

ID Output

PH Curve


Facial Drawing


Representation of Surface


Projections and Shadows


Ratio of the Circumference


Double Helix

Cone/Cone Intersection

Sierpinski tiling arrowhead


Sierpinski carpet


            相關書籍:             Computer Graphics using Open GL by F.S. Hill, Jr.




                                           OpenGL Programming Guide

                                           Silicon Graphic

            相關網站:      Search Engine: 後鍵入OpenGL或Computer Graphics 搜尋

                                   CG basic idea:


                                   CG Research Site: