Introduction to DirectX Programming Dongho Kim February 12, 2002 Dongho Kim February 12, 2002.

Slides:



Advertisements
Similar presentations
Programming with OpenGL - Getting started - Hanyang University Han Jae-Hyek.
Advertisements

OpenGL Course Notes Chapter 1: Introduction Jim Mims.
Multimedia Seminar DirectX – use und concepts. 2 structure development / definition parts of DirectX versions concepts perspective.
CP411 Computer Graphics, Wilfrid Laurier University Introduction # 1 Welcome to CP411 Computer Graphics 2012 Instructor: Dr. Hongbing Fan Introduction.
DirectX: A Brief Overview Daniel D’Agostino. Example: Far Cry 2.
Irrlicht Engine Overview By Eric Osugi. Irrlicht's development started in 2003 with only Nikolaus Gebhardt. Only after the 1.0 release of Irrlicht in.
Status – Week 259 Victor Moya. Summary OpenGL Traces. OpenGL Traces. DirectX Traces. DirectX Traces. Proxy CPU. Proxy CPU. Command Processor. Command.
Computer Games: History and Content Presented by Barry Dean UWE.
Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.
Using PlayCap. Introduction  Based on: 1. Win32 API 2. DirectShow API 3. GDI+ API  Platform Windows XP  IDE Visual Studio.Net 2003.
1 A presentation on DirectX® Alex Brill Emil Elazar Noam Monheit.
Platforms and tools for Web Services and Mobile Applications Introduction to C# Bent Thomsen Aalborg University 3rd and 4th of June 2004.
Klas Skogmar, Lund Institute of Technology Real-time Video Effects Using Programmable Graphics Cards Master of Science Thesis Klas Skogmar
Realtime 3D Computer Graphics Computer Graphics Computer Graphics Software & Hardware Rendering Software & Hardware Rendering 3D APIs 3D APIs Pixel & Vertex.
Computer Graphics Introducing DirectX
CSE328:Computer Graphics OpenGL Tutorial Dongli Zhang Department of Computer Science, SBU Department of Computer Science, Stony.
1 CO Games Concepts Week 24 Preparation for next year Gareth Bellaby.
Lesson 4 Computer Software
Chapter Three Software and Operating Systems What is software? How software is developed (Analysis, Design, Programming, and Testing) What are software.
Antigone Engine Kevin Kassing – Period
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
CHAPTER 4 Window Creation and Control © 2008 Cengage Learning EMEA.
A Tutorial to DirectShow Ruigang Yang August, 2001.
DirectShow.
차세대 그래픽 개발 환경.NET & DirectX 강성재 Community Specialist Microsoft Corporation.
OpenGL Shading Language (Advanced Computer Graphics) Ernest Tatum.
CSC 461: Lecture 41 CSC461: Lecture 4 Introduction to OpenGL Objectives: Development of the OpenGL API OpenGL Architecture -- OpenGL as a state machine.
1 ETC. 2 Sounds FX Sounds FX –WAV audio files –Load into memory and play it »Load »Play »Stop »Pause –2D or 3D »3D should be integrated into scene management.
Computer Graphics Tz-Huan Huang National Taiwan University.
The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,
Computer Graphics Using Direct 3D Introduction. 2 What are we doing here? Simply, learning how to make the computer draw.
Java2C# Antonio Cisternino Part V. Outline Assembly & co. Visual Studio environment Example: using DirectX from C#
Teachers Discovering Computers Integrating Technology and Digital Media in the Classroom 5 th Edition Let’s Review Lesson 2! Who Wants to Be a Computer.
Computer Software. Software n According to the American Heritage Dictionary software is n "The programs, routines, and symbolic languages that control.
Sound DirectMusic & DirectSound. DirectShow Video Formats DirectShow is an open architecture, it can support any format as long as there are filters to.
GPGPU Tools and Source Code Mark HarrisNVIDIA Developer Technology.
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
3D Programming and DirectX API. Content Mathematics Mathematics Prepare to Write a 3D program Prepare to Write a 3D program Program Structure Program.
The Cg Runtime Cyril Zeller. Cg Pipeline Graphics programs are written in Cg and compiled to low-level assembly code... Cg Runtime API...
1 Contents  Audio  Sprite  Input devices  Game production milestones  Course summary.
GAM666 – Introduction To Game Programming ● DirectX is implemented as a collection of COM objects ● To use a DirectX program, the user must have the correct.
Learning with Modern OpenGL Evan Hart NVIDIA. Disclaimer  Deprecated functionality supported by many vendors  Old versions of OpenGL are still supported.
Computer Graphics 3 Lecture 6: Other Hardware-Based Extensions Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
GAM666 – Introduction To Game Programming ● Programmer's perspective of Game Industry ● Introduction to Windows Programming ● 2D animation using DirectX.
Win32 Programming Lesson 19: Introduction to DLLs.
ITP 109 Week 2 Trina Gregory Introduction to Java.
OPERATING SYSTEMS (OS) By the end of this lesson you will be able to explain: 1. What an OS is 2. The relationship between the OS & application programs.
A Detailed Introduction To Visual Studio.NET CRB Tech ReviewsCRB Tech Reviews introduces you to the world of Visual.
What is DirectX? DirectX is built by Microsoft as a collection of API’s (Application Programming Interfaces) for the purpose of multimedia processing.
Windows Programming Environments
Khang Lam Daniel Limas Kevin Castillo Juan Battini
Games Development Practices 3D Modelling
Antigone Engine.
Computer Graphics Lecture 32
Advanced Graphics Algorithms Ying Zhu Georgia State University
Managed DirectX Joe Gavin.
MonoGame and Windows 8.
Introduction to Computer Graphics with WebGL
Unit 20 Software Part 2.
Unit 20 Software Part 2.
3D applications in Delphi
HW for Computer Graphics
CO Games Concepts Week 25 Preparation for next year
Computer Graphics Introduction to Shaders
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
Computer Graphics Introducing DirectX
Games Development 2 Tools Programming
OpenGL-Rendering Pipeline
Presentation transcript:

Introduction to DirectX Programming Dongho Kim February 12, 2002 Dongho Kim February 12, 2002

© 2001 Dongho Kim, GWU Institute for Computer Graphics 2 What is DirectX 2D/3D graphics / multimedia API Made and maintained by MicrosoftMade and maintained by Microsoft Designed for Game and Multimedia ProgrammingDesigned for Game and Multimedia Programming Works only on MS Windows platformWorks only on MS Windows platform –95/98/ME/2000/XP –Old version for Windows NT 2D/3D graphics / multimedia API Made and maintained by MicrosoftMade and maintained by Microsoft Designed for Game and Multimedia ProgrammingDesigned for Game and Multimedia Programming Works only on MS Windows platformWorks only on MS Windows platform –95/98/ME/2000/XP –Old version for Windows NT

© 2001 Dongho Kim, GWU Institute for Computer Graphics 3 Versions of DirectX First introduction in 1996 Goal: Easy game programming under MS WindowsGoal: Easy game programming under MS Windows Current versions DirectX 8.1 : Windows 95/98/ME/2000 (2001)DirectX 8.1 : Windows 95/98/ME/2000 (2001) –Built-in in Windows XP DirectX 3 : Windows NT 4.0DirectX 3 : Windows NT 4.0 DirectX 9 : under beta testDirectX 9 : under beta test First introduction in 1996 Goal: Easy game programming under MS WindowsGoal: Easy game programming under MS Windows Current versions DirectX 8.1 : Windows 95/98/ME/2000 (2001)DirectX 8.1 : Windows 95/98/ME/2000 (2001) –Built-in in Windows XP DirectX 3 : Windows NT 4.0DirectX 3 : Windows NT 4.0 DirectX 9 : under beta testDirectX 9 : under beta test

© 2001 Dongho Kim, GWU Institute for Computer Graphics 4 Versions of DirectX (cont.) Backward Compatible Applications complied with older version should work with newer versionApplications complied with older version should work with newer version Backward Compatible Applications complied with older version should work with newer versionApplications complied with older version should work with newer version

© 2001 Dongho Kim, GWU Institute for Computer Graphics 5 Components of DirectX Direct3D DirectDraw: integrated into Direct3D in DX 8 DirectShow: integrated into Direct3D in DX 8 DirectSound / DirectMusic DirectInputDirectPlayDirectSetupDirect3D DirectDraw: integrated into Direct3D in DX 8 DirectShow: integrated into Direct3D in DX 8 DirectSound / DirectMusic DirectInputDirectPlayDirectSetup

© 2001 Dongho Kim, GWU Institute for Computer Graphics 6 Comparison of DirectX and OpenGL (1) DirectX Controlled by Microsoft; frequent updatesControlled by Microsoft; frequent updates Many features for game programmingMany features for game programming –Sound, input, media stream, … –Non-core functionality such as file format reader (image and 3D model) OpenGL Controlled by OpenGL ARB; only a few updatesControlled by OpenGL ARB; only a few updates General purpose 2D/3D graphics API; 2D is weakGeneral purpose 2D/3D graphics API; 2D is weakDirectX Controlled by Microsoft; frequent updatesControlled by Microsoft; frequent updates Many features for game programmingMany features for game programming –Sound, input, media stream, … –Non-core functionality such as file format reader (image and 3D model) OpenGL Controlled by OpenGL ARB; only a few updatesControlled by OpenGL ARB; only a few updates General purpose 2D/3D graphics API; 2D is weakGeneral purpose 2D/3D graphics API; 2D is weak

© 2001 Dongho Kim, GWU Institute for Computer Graphics 7 Comparison of DirectX and OpenGL (2) DirectX Only Microsoft Windows platform; MMX, 3DNowOnly Microsoft Windows platform; MMX, 3DNow Rather difficult to learnRather difficult to learn –not many documentation; stick to MS documentations OpenGL Platform independent (Windows, Linux, Unix, Apple, …)Platform independent (Windows, Linux, Unix, Apple, …) Rather easy to learn; many 3 rd party documentationsRather easy to learn; many 3 rd party documentationsDirectX Only Microsoft Windows platform; MMX, 3DNowOnly Microsoft Windows platform; MMX, 3DNow Rather difficult to learnRather difficult to learn –not many documentation; stick to MS documentations OpenGL Platform independent (Windows, Linux, Unix, Apple, …)Platform independent (Windows, Linux, Unix, Apple, …) Rather easy to learn; many 3 rd party documentationsRather easy to learn; many 3 rd party documentations

© 2001 Dongho Kim, GWU Institute for Computer Graphics 8 DirectX 8.1 SDK InstallationInstallation

© 2001 Dongho Kim, GWU Institute for Computer Graphics 9 Using DirectX SDK (1) Include and Lib directories DocumentationSamplesUtilities Paths are included in Visual C++ automatically (DX8)Paths are included in Visual C++ automatically (DX8) Include and Lib directories DocumentationSamplesUtilities Paths are included in Visual C++ automatically (DX8)Paths are included in Visual C++ automatically (DX8)

© 2001 Dongho Kim, GWU Institute for Computer Graphics 10 Using DirectX SDK (2) Direct3DX library Similar to GLU in OpenGLSimilar to GLU in OpenGL Collection of useful functionalitiesCollection of useful functionalities –Math, Mesh, Shader, … –Interfaces starting with “ID3DX” –Functions starting with “D3DX” Direct3DX library Similar to GLU in OpenGLSimilar to GLU in OpenGL Collection of useful functionalitiesCollection of useful functionalities –Math, Mesh, Shader, … –Interfaces starting with “ID3DX” –Functions starting with “D3DX”

© 2001 Dongho Kim, GWU Institute for Computer Graphics 11 Using DirectX SDK (3) “Common” directory (DX8) C++ source codeC++ source code Not part of DirectX, but contains useful source codesNot part of DirectX, but contains useful source codes –DirectX initialization, window creation, … Most of the samples link with this partMost of the samples link with this part “Common” directory (DX8) C++ source codeC++ source code Not part of DirectX, but contains useful source codesNot part of DirectX, but contains useful source codes –DirectX initialization, window creation, … Most of the samples link with this partMost of the samples link with this part

© 2001 Dongho Kim, GWU Institute for Computer Graphics 12 Demo: DirectX 8.1 Samples Most of the features are shown Start your own project from a sample in DirectX SDK Most of the features are shown Start your own project from a sample in DirectX SDK

© 2001 Dongho Kim, GWU Institute for Computer Graphics 13 COM (Component Object Model) DirectX libraries are implemented as COM COM object is a black box performing one or more tasks Similar to C++ objectsSimilar to C++ objects Implemented as DLLImplemented as DLL Stricter encapsulationStricter encapsulation Not explicitly loadedNot explicitly loaded Supports many programming languagesSupports many programming languages DirectX libraries are implemented as COM COM object is a black box performing one or more tasks Similar to C++ objectsSimilar to C++ objects Implemented as DLLImplemented as DLL Stricter encapsulationStricter encapsulation Not explicitly loadedNot explicitly loaded Supports many programming languagesSupports many programming languages

© 2001 Dongho Kim, GWU Institute for Computer Graphics 14 Programming with COM May be complex But it is not so difficult We do not make COM objectsWe do not make COM objects We simply use COM objectsWe simply use COM objects Interface is used to access the the functionality of COM objectsInterface is used to access the the functionality of COM objects –Class names start with I Start from the samples with “Common” filesStart from the samples with “Common” files May be complex But it is not so difficult We do not make COM objectsWe do not make COM objects We simply use COM objectsWe simply use COM objects Interface is used to access the the functionality of COM objectsInterface is used to access the the functionality of COM objects –Class names start with I Start from the samples with “Common” filesStart from the samples with “Common” files

© 2001 Dongho Kim, GWU Institute for Computer Graphics 15 Example of COM instantiation IDirect3DDevice8 *g_pd3dDevice = NULL; if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, 3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &g_pd3dDevice ))) return E_FAIL; IDirect3DDevice8 *g_pd3dDevice = NULL; if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, 3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &g_pd3dDevice ))) return E_FAIL;

© 2001 Dongho Kim, GWU Institute for Computer Graphics 16 Recommendations on how to start DirectX programming Some knowledge on Windows Programming is required Start with Newest version, DirectX 8.1 Start from the SAMPLES in the SDK Most of the examples are written without MFCMost of the examples are written without MFC –Mostly performance issues in games Only some of them are written with MFCOnly some of them are written with MFC Some knowledge on Windows Programming is required Start with Newest version, DirectX 8.1 Start from the SAMPLES in the SDK Most of the examples are written without MFCMost of the examples are written without MFC –Mostly performance issues in games Only some of them are written with MFCOnly some of them are written with MFC

© 2001 Dongho Kim, GWU Institute for Computer Graphics 17 Lecture from now on Focus on Direct3D Follow the tutorials in DX8.1 SDK Tutorials do not use “Common” files, thoughTutorials do not use “Common” files, though Samples using “Common” files Focus on Direct3D Follow the tutorials in DX8.1 SDK Tutorials do not use “Common” files, thoughTutorials do not use “Common” files, though Samples using “Common” files

© 2001 Dongho Kim, GWU Institute for Computer Graphics 18 Tutorial 1: CreateDevice

© 2001 Dongho Kim, GWU Institute for Computer Graphics 19 Tutorial 2: Vertices

© 2001 Dongho Kim, GWU Institute for Computer Graphics 20 Tutorial 3: Matrices

© 2001 Dongho Kim, GWU Institute for Computer Graphics 21 Tutorial 4: Lights

© 2001 Dongho Kim, GWU Institute for Computer Graphics 22 Tutorial 5: Textures

© 2001 Dongho Kim, GWU Institute for Computer Graphics 23 Tutorial 6: Meshes

© 2001 Dongho Kim, GWU Institute for Computer Graphics 24 Sample: Billboard

© 2001 Dongho Kim, GWU Institute for Computer Graphics 25 Extras in SDK X file exporter 3D Studio MAX version 3 / 43D Studio MAX version 3 / 4 Maya version 2.5 / 3.0 / 4.0Maya version 2.5 / 3.0 / 4.0 X file exporter 3D Studio MAX version 3 / 43D Studio MAX version 3 / 4 Maya version 2.5 / 3.0 / 4.0Maya version 2.5 / 3.0 / 4.0

© 2001 Dongho Kim, GWU Institute for Computer Graphics 26 Next week Advanced features Programmable shaderProgrammable shader –Vertex shader / Vertex program –Pixel shader / register combiner Multi-texturing / Multi-pass texturingMulti-texturing / Multi-pass texturing Game specific topics joystick, frame rate control, etc…joystick, frame rate control, etc… Advanced features Programmable shaderProgrammable shader –Vertex shader / Vertex program –Pixel shader / register combiner Multi-texturing / Multi-pass texturingMulti-texturing / Multi-pass texturing Game specific topics joystick, frame rate control, etc…joystick, frame rate control, etc…

© 2001 Dongho Kim, GWU Institute for Computer Graphics 27 Bookmarks microsoft.public.win32.programmer.directxmicrosoft.public.win32.programmer.directx microsoft.public.directxmicrosoft.public.directx OpenGL vs DirectX comparison microsoft.public.win32.programmer.directxmicrosoft.public.win32.programmer.directx microsoft.public.directxmicrosoft.public.directx OpenGL vs DirectX comparison