2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 1 Lecture 9: Personal Computers - System Hardware and Software Raine Mäki, Reima Saarinen Dept. of CSE, Helsinki University of Tech. Sangjin Han Dept. of EECS, Korea Advanced Institute of Sci. & Tech.
49
Embed
Lecture 9: Personal Computers - System Hardware and Software
Lecture 9: Personal Computers - System Hardware and Software. Raine Mäki, Reima Saarinen Dept. of CSE, Helsinki University of Tech. Sangjin Han Dept. of EECS, Korea Advanced Institute of Sci. & Tech. Overview of the presentation. System hardware - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 1
Lecture 9:
Personal Computers- System Hardware and Software
Raine Mäki, Reima SaarinenDept. of CSE, Helsinki University of Tech.
Sangjin HanDept. of EECS, Korea Advanced Institute of Sci. &
Tech.
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 2
Overview of the presentation
• System hardware A walkthrough of different multimedia
related devices in PCs
• System software Operating systems Multimedia APIs GUI toolkits
• Extra Case Study: PC vs. PlayStation2
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 3
System hardware
• System architectures• Processors (CPUs)• Main memory• Mass storage devices• Display devices• Graphics cards (GPUs)• Sound related devices• Other multimedia devices
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 4
System architectures
• Basic CPU/memory/bus model is the most common system architecture
Red Hat, Xandros, Slackware, Ubuntu, etc..• Most are freely downloadable from the
Internet• Some distros cost money
– By giving money you will get CDs, support services, user manuals etc.
A Unix type OS Source code is available Is stable and secure (at least some distros
are) A true multi-user environment Not all programs or games are available in
Linux Because of lack of device drivers, not all
hardware works with Linux.
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 15
Operating systems (cont’d)
• Mac OS X Current version of OS X is Tiger
(10.4) Previous one was Panther (10.3) Macs and OS Xs are known to be
used mainly by graphics artists and content producers
It’s easy to use and its usability is far better that other OSs.
Under the pretty outlook, it is still a Unix based OS
• Macs look nice and trendy• Some could argue that Macs are not
really PCs at all, because they are not that customizable
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 16
Multimedia APIs
• This part introduces a few Multimedia Application programming Interfaces (APIs)
• I'm going to consentrate on the Windows environment and especially on Windows API and DirectX I'll also show a few code examples
• I'm also going to tell shortly what are DirectFB, OpenGL (probably quite familiar already) and SDL
• I'm trying to be a little practical so I'm not going to tell about the history of these APIs in detail Everyone interested can search for more information
from the internet or by using the provided links in the end
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 17
Windows API
• Provides building blocks for applications that are written for Windows
• Designed for C/C++ programmers• Familiarity with the Windows graphical user
interface and message-driven architecture is required
• Examples that Win API can be used to: graphical user interfaces display graphics and formatted text (GDI) manage system objects such as memory, files, and
processes sounds and video (Windows Multimedia)
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 18
User Interface
• Windowing• Resources
Icons, cursors, menus...
• Common controls Buttons, text fields, edits, syslinks
(hypertext), scroll bars, list boxes...
• User input Keyboard, mouse...
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 19
Graphical Device Interface (GDI)
• Used in most Windows applications to generate graphical output for video displays and printers
• Can draw lines, curves, closed figures, paths, text, and bitmap images
• Color and style depends on selected or created drawing objects: pens, brushes and fonts
• GDI+ is improvement to GDI that optimizes existing features and adds for example gradient colors, alpha blending Included in Windows XP and Windows Server 2003
(available to some earlier Windows’) Also improves the API
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 20
Windows Multimedia
• A basic Windows library• Enables applications for example to play
sounds and video and to record sounds• Used in PlaySound example
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 21
DirectX
• One of the most popular APIs in game development
• Only works in Windows (and Xbox)• Provides APIs enabling software developers
to access specialized hardware features without having to write hardware-specific code
• Enables higher performance in graphics and sound when you’re playing games or watching video
• Consists of many components that are meant for different kinds of tasks
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 22
DirectX 9.0 Main Components
• DirectX Graphics component combines the Direct3D component and the D3DX utility library, which simplifies many graphics programming tasks
• DirectInput component provides support for a variety of input devices, including full support for force-feedback technology
• DirectSound component can be used in the development of high-performance audio applications that play and capture waveform audio
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 23
Old DirectX Components
• DirectDraw handled all 2D drawing but it isn't available anymore and using it is no longer recommended In DirectX 9.0 all 2D functionality is contained
within Direct3D and its associated helper functions in D3DX
DirectDraw documentation is still available and can be viewed on MSDN
• DirectMusic will maintain its current status until new technology is made available DirectMusic documentation can be found at:
<SDK Root>/Documentation/DirectX9
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 24
Old DirectX Components (cont'd)
• DirectPlay is deprecated and Microsoft strongly recommends against using it to develop new applications Game developers should use Windows
Sockets and the Windows Firewall APIs
• DirectShow is no longer recommended for game development All of the DirectShow components were
removed from the DirectX 9.0 SDK Update April 2005, but are available in the latest Platform SDK Install
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 25
DirectX Example: Far Cry
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 26
DirectFB
• Thin library that provides: Hardware graphics acceleration Input device handling and abstraction Integrated windowing system and
multiple display layers on top of the Linux Framebuffer Device
• Supports GNU/Linux and FreeBSD, NetBSD, OpenBSD without accelation support
• Support for Mac OS X is currenly worked on
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 27
DirectFB Example: Quake 3: Arena
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 28
OpenGL
• Free environment for developing portable, interactive 2D and 3D graphics applications.
• Since its introduction in 1992, OpenGL has become the industry's most widely used and supported 2D and 3D graphics API, bringing thousands of applications to a wide variety of computer platforms
• Speeds application development by incorporating a broad set of rendering, texture mapping, special effects, and other powerful visualization functions
• Many OpenGL extensions, as well as extensions to related APIs like GLU, GLX, and WGL, have been defined by vendors and groups of vendors
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 29
OpenGL ES
• Royalty-free, cross-platform API for full-function 2D and 3D graphics on embedded systems Consoles Phones Appliances
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 30
OpenGL Example:Homeworld 2
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 31
Simple DirectMedia Layer (SDL)
• Cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL or DirectX and 2D video framebuffer
• Used e.g. for games, emulators, demos, multimedia applications
• Supports Linux, Windows, BeOS, MacOS Classic, MacOS X, FreeBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX Some unofficial support for Windows CE,
AmigaOS, Dreamcast, Atari, NetBSD, AIX, OSF/Tru64, RISC OS, and SymbianOS
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 32
SDL (cont'd)
• Written in C but works with C++ natively• Has bindings to several other languages,
including Ada, Eiffel, Java, Lua, ML, Perl, PHP, Pike, Python, and Ruby
• Currently available under the GNU Lesser General Public License (LGPL) version 2 or newer.
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 33
Using SDL
• Initializing the library • Video
Choosing and setting video modes Drawing pixels on the screen and loading
and displaying images
• Events Waiting for events Polling for events and event states
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 34
Using SDL (cont'd)
• Audio Opening the audio device Loading and playing sounds CD-ROM audio
• Threads Create a simple thread Synchronizing access to a resource
• Timers Get the current time, in milliseconds Wait a specified number of milliseconds
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 35
SDL Example:NetHack Falcon Eye
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 36
GUI toolkits
• What is a GUI toolkit? (Widget toolkit) A set of basic building elements for
graphical user interfaces.
Widgets: GUI:
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 37
For Windows
• Windows API A basis of all GUI toolkits on Windows
• MFC (Win32)• Windows Forms (.NET)
• OWL VCL CLX Of Borland
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 38
For X Window System
• X doesn’t offer any common widgets. The reason why X applications look
different.
• Two major GUI toolkitsQT• Managed by Trolltech• Basis of KDE• C++
GTK+• GPL• Basis of GNOME• C (with an OOP
manner)• Originally for GIMP
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 39
For Java
• AWT In early versions of Java Direct mapping to
native widgets•Heavyweight
• Swing Since Java 2 Controls widgets by
itself•Lightweight•Low-performance
• SWT
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 40
Examples: How to make a GUI app?
• Simple “Hello World” Programs on Windows using Win32 api (Message-handling manner) QT (Event-handling manner) Windows Forms (IDE-integrated manner)
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 41
Hello World – (1) Win32 API
• Tens of lines should be coded even for a simple application.
• Message handling When clicked, a WM_COMMAND message
is passed.
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 42