A maior rede de estudos do Brasil

433 pág.
Apostila PyOpenGL

Pré-visualização | Página 3 de 50

all 4th quarter projects would involve 
graphics. The first graphics on the Apple were slow and rather crude by present 
standards. They were barely interactive, if at all. Even on our first PC’s it would take 
several minutes to display minimal fractal images. Not so today. With the computers we 
have in our lab we can create sophisticated graphics that can be manipulated in real-
time… something we didn’t even dream of back in 1980! It only took me 20 years to 
realize that my students were trying to tell me something! For the past 5 years we have 
concentrated on learning computer programming through computer graphics and that is 
what you will be doing this year. Learning how to program is hard work, but at the same 
time, it is very rewarding and can be great fun! 
 So, if a picture is worth a thousand words, how much more valuable is a 
changeable, interactive, creative graphics scene? You can graph mathematical 
functions in 2D, 3D, and even 4D. You can create true stereo images! You can design 
programs to simulate real-world events and you can manipulate the laws of physics and 
create your own worlds. If you are an artist, the computer becomes your easel. If you 
like games, you can program your own according to your own specifications. The 
computer can become a window into your mind and your limitations are governed by 
your imagination. What you can envision, you can create! Now how cool is that? 
 Oh, I forgot to say that you can make a fantastic living doing this stuff… just ask 
the folks at PIXAR.10 
9 Previous computers used the cpu and onboard memory for graphics. This made them slow. A 
dedicated graphics board handles most of the work and has its own much speedier memory. 
This allows us to create some rather fancy graphics. By comparison, my laptop has 256 mb of 
video memory alone… more than the system memory of many computers. 
10 You know, the people who made “The Incredibles” and other such movies. 
Chapter 2 Needs, Expectations, and Justifications 
Section 2.1 What preparation do you need? 
 In order to successfully complete this class, you will need to have some 
knowledge of computer operations as a prerequisite. This class is NOT an introduction 
to computers or a computer concepts class. This is a programming class and I expect 
that you already know something about computers. You should already be able to use a 
computer to do tasks such as word processing, gaming, and internet searches. You 
should know how to install programs and you should know how to follow directions. You 
don’t need to know how to program, although it’s certainly OK if you have some 
programming experience. 
 In terms of knowledge, you should have some familiarity with algebra and 
geometry. You don’t have to be an “A” student, but you should be comfortable with the 
concept of variables, equations, points, lines, angles, and coordinates in the x, y, and z 
axes. Also, you should have some knowledge of physics and physical science, 
particularly the equations and concepts for location, distance, velocity, and acceleration. 
If you are uncomfortable at this point, take a deep breath, relax, and simply be prepared 
to work a bit harder and I think you’ll be fine. 
Section 2.2 What hardware and software do you need? 
 If you are physically in my computer science class, then your computer and 
software needs are already met by our lab computers. If you are reading this on your 
own, then I should take some time to tell you what minimum hardware and software you 
will need to complete the examples in the text. At a minimum, you should have a 
computer with at least 128 mb of RAM and a dedicated video card with at least 32 mb of 
video RAM. Most current minimum computer systems should suffice.1 If your computer 
doesn’t quite meet the minimum requirements, then give the programs a try anyway. 
They’ll probably run fine, albeit more slowly. 
As far as software is concerned, we will be using a programming language called 
Python with the PyOpenGL module.2 We will also use an open source programming 
editor called DrPython, although other fine open source editors such as Scite are 
available. Again, if you are in my class, these programs are already on the lab 
computers. If you are studying on your own, the programs may be downloaded from the 
internet at no cost.3 I use both Windows and Linux without a real preference, although it 
is probably easier to use the Windows platform in terms of the necessary software 
1 More is better! 
2 You will need to have OpenGL and GLUT installed on your computer. Windows machines 
already have OpenGL installed. You may need to search online for GLUT and install the 
glut32.dll file in your system directory. 
3 Use your search engine. DrPython needs another program called wxWindows, also freely 
available. If you need help with the installations, seek advice from your teacher or friendly 
neighborhood computer geek. These programs are “Open Source”, meaning that they are free. 
installation. All the program examples in this text will work on either platform as long as 
the proper software is installed.4 
Section 2.3 My Expectations 
 My expectations are simple. I expect you to make an honest effort to learn the 
material. If you feel that you are deficient in an area, then take some time and 
strengthen your knowledge. I expect you to try the programs in this text, to modify the 
programs, and to create some programs of your own. The exercises at the end of each 
section or chapter will help achieve fluency in programming and should be attempted 
with honest effort.5 If you have “bugs”6 in your program, try to find them yourself rather 
than immediately asking for help. Even though I enjoy helping my students, it gets a bit 
tiresome when a student insists that “the program you gave us doesn’t work” after about 
10 seconds of effort. At that point, the student will sit back and expect me to fix the 
problem. You’ll learn much more if you spend the time to find and repair your own 
 I will start out by making a valiant effort to explain as much as possible in each 
chapter, section, and individual program. But as we progress through the text, I plan to 
explain less and less (always difficult for a teacher… I should explain less? Ask me the 
time and I’ll tell you how to make a watch!) At some point you, the student, should 
become self-sufficient and research for yourself various topics of interest or concepts 
that you do not understand. When you reach the point where you are an independent 
learner, then you have attained an elusive, but important goal. Every individual should 
strive to become an independent learner and it should be the goal of every teacher to try 
to help students attain this coveted plateau. Whether or not I am successful in this goal 
will depend on whether or not YOU are successful in becoming a self-sufficient 
Section 2.4 Your Expectations 
 You should have some realistic expectations for the class. You will most likely 
NOT be recruited by Electronic Arts7 following the completion of this course. You will be 
able to create some interesting interactive computer generated graphics, however. You 
will also have a fairly solid background in basic programming and a platform for further 
learning, either independently or formally. Since this course was started almost 30 years 
ago, over 40 former students have gone on to rewarding careers in the computer 
science field. So if this type of work interests you, then you may have found the start to 
a great career opportunity! I am not trying to toss out clichés, but you WILL get out of 
this course a level of expertise that will correlate highly with

Crie agora seu perfil grátis para visualizar sem restrições.