As of Directx 8, Directdraw (2D) and Direct3d (3D) Have Been Combined

Total Page:16

File Type:pdf, Size:1020Kb

As of Directx 8, Directdraw (2D) and Direct3d (3D) Have Been Combined GAM666 – Introduction To Game Programming Basic 3D Using DirectX 9 ● As of DirectX 8, DirectDraw (2D) and Direct3D (3D) have been combined into DirectX Graphics (still often called Direct3D, however) ● DirectX Graphics includes a library of 3D math helper functions, d3dx9math.h, the use of which is entirely optional but has gained wide acceptance GAM666 – Introduction To Game Programming Basic 3D Using DirectX 9 DirectX 9 COM Object Pointers: ● LPDIRECT3D9 – main Direct3D control object used to create others ● LPDIRECT3DDEVICE9 – device onto which 3D is rendered ● LPDIRECT3DVERTEXBUFFER9 – list of vertices describing a shape to be rendered ● LP3DXFONT – font for rendering text onto a 3D scene GAM666 – Introduction To Game Programming Basic 3D Using DirectX 9 Basic frame rendering logic: ● Clear the display target's backbuffer using Direct3DDevice Clear() ● Call Direct3DDevice BeginScene() ● Render primitives [shapes] using Direct3DDevice DrawPrimitive() and text using Direct3DXFont DrawText() ● Call Direct3DDevice EndScene() ● Flip backbuffer to screen with Direct3DDevice Present() GAM666 – Introduction To Game Programming 3D Setup ● Direct3DCreate9() to create Direct3D object ● Enumeration in DirectX Graphics is easier than in DirectDraw7 (no enumeration callback function needs to be supplied, rather call a query function in your own loop) ● Direct3D CreateDevice() to create Direct3DDevice ● Direct3DDevice CreateVertexBuffer() to allocate vertex buffers ● D3DXCreateFont() to make 3D font GAM666 – Introduction To Game Programming Critical d3dx9math.h data types ● D3DXVECTOR3 – x, y and z coordinates for a 3D point or vector (context determines which) ● D3DXMATRIX – 4x4 3D transformation matrix ● There are many D3DX* functions to create or manipulate these ● Visit http://gpwiki.org/index.php/3D:Matrix_Math to review basics of 3D vectors and matrix arithmetic GAM666 – Introduction To Game Programming Fixed Function Transformation Pipeline Direct3D has us specify 3 transformation matrices (each vertex is transformed by all three, in turn, before it is rendered): ● World matrix – moves a vertex from its specified coordinates to somewhere else ● View matrix – moves a vertex so it will be as if we were looking from a particular viewpoint (with increasing Z coordinates in front of us) ● Projection matrix – moves a vertex so that if we ignore the Z coordinate (2D projection), reasonable perspective will be apparent GAM666 – Introduction To Game Programming Fixed Function Transformation Pipeline Use Direct3DDevice SetTransform() to change one of the transformation matrices: ● The world matrix is changed whenever we have a primitive to render that should not be moved to where the current world matrix would move it (typically, just before rendering each relocatable primitive) ● The view matrix is changed whenever we want the “camera” or viewpoint to change, typically with each frame as the user moves around ● The projection matrix is changed whenever we want to change the perspective or clipping, typically only once at the beginning GAM666 – Introduction To Game Programming Flexible Vertex Formats (FVF) ● When a vertex buffer is created, there is some flexibility in specifying exactly what data will be supplied for each vertex of a primitive (e.g. with a texture you need to supply texture coordinates for each vertex, but with no texture you might want to specify a colour for each vertex) ● The D3DFVF_ flags identify which pieces of data you'll be using, e.g. ● D3DFVF_XYZ means you want XYZ coordinates (almost always want this) ● D3DFVF_DIFFUSE means you want to specify a [diffuse] colour (sometimes want) GAM666 – Introduction To Game Programming Flexible Vertex Formats (FVF) ● Although FVF flags are combined with bitwise or (|) - so the order they are specified in doesn't matter - there IS an order in which the matching data will appear in the vertex buffer ● Use “Vertex Formats” in Visual Studio help to see the order the data will appear in the vertex buffer when specific vertex flags are used ● Use Direct3DDevice SetFVF() to specify what vertex format you are about to use GAM666 – Introduction To Game Programming Vertex Buffer Primitive Types ● D3DPT_POINTLIST – list of separate points ● D3DPT_LINELIST – list of line segments, 2 vertices per segment ● D3DPT_LINESTRIP – list of joined line segments, 2 vertices for first, 1 for each thereafter ● D3DPT_TRIANGLELIST – list of triangles, 3 vertices per triangle ● D3DPT_TRIANGLEFAN – list of triangles sharing a common starting point, 3 vertices for the first, 1 for each thereafter ● D3DPT_TRIANGLESTRIP – list of triangles, each sharing two points with the next, 3 vertices for the first, 1 for each thereafter GAM666 – Introduction To Game Programming Using Vertex Buffers ● Since vertex buffers may live on the video card or elsewhere where shared access may be a problem, you must lock a vertex buffer area before you update it, and unlock it when you are done ● Don't update vertex buffers needlessly, as it is potentially slow ● Use Direct3DDevice SetStreamSource() to identify which vertex buffer to use ● Use Direct3DDevice DrawPrimitive() to render a primitive from the current vertex buffer, specifying the type of primitive and number of primitives. GAM666 – Introduction To Game Programming Other Considerations ● The Direct3DDevice will probably need to be Reset() if you regain focus after losing it, and the vertex buffers (and anything else that might have resided in video memory) may have to be refilled or reallocated ● Use Direct3DDevice SetRenderState() to turn features (such as lighting and alpha blending) on or off, or otherwise control them ● Note that most of the characteristics of the fixed function transformation pipeline are obsoleted by newer, but not universally available, shader technology – double coverage is required for the near future.
Recommended publications
  • (RUNTIME) a Salud Total
    Windows 7 Developer Guide Published October 2008 For more information, press only: Rapid Response Team Waggener Edstrom Worldwide (503) 443-7070 [email protected] Downloaded from www.WillyDev.NET The information contained in this document represents the current view of Microsoft Corp. on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This guide is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form, by any means (electronic, mechanical, photocopying, recording or otherwise), or for any purpose, without the express written permission of Microsoft. Microsoft may have patents, patent applications, trademarks, copyrights or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, e-mail address, logo, person, place or event is intended or should be inferred.
    [Show full text]
  • Summary Both the Desktop Graphics And
    Summary Both the desktop graphics and animated film industries are striving to create spectacular, lifelike worlds. Film quality realism requires complicated per-pixel operations, previously impractical for desktop graphics which must render frames as fast as 60 times per second. The 3D Blaster GeForce2 GTS is the first Graphics Processing Unit (GPU) with the 3D performance and enhanced feature set necessary to approach this distinct level of realism. The 3D Blaster GeForce2 GTS is a State of the Art 3D Graphics Accelerator. The combination between Nvidia’s 2nd Generation Transform & Lighting (T&L) Architecture and the Nvidia Shading Rasterizer (NSR) produces one of the most stunning and realistic visuals ever seen on screen. The integrated NSR makes advanced per-pixel shading capabilities possible. This breakthrough technology has the ability to process seven pixel operations in a single pass on each of four pixel pipelines, simultaneously. The end result of this is to allow individual pixel control of colour, shadow, light, reflectivity, emissivity, specularity, loss, dirt, and other visual and material components used to create amazingly realistic objects and environments. Per-pixel shading delivers the next-generation of visual realism by going beyond the limited texture mapping techniques of previous graphics processors. • New HyperTexel architecture delivers 1.6 gigatexels per second for staggering frame rates and high- performance anti-aliasing • New NVIDIA Shading Rasterizer (NSR) delivers per pixel shading and lighting for rich,
    [Show full text]
  • Beginning .NET Game Programming in En
    Beginning .NET Game Programming in en DAVID WELLER, ALEXANDRE SANTOS LOBAo, AND ELLEN HATTON APress Media, LLC Beginning .NET Game Programming in C# Copyright @2004 by David Weller, Alexandre Santos Lobao, and Ellen Hatton Originally published by APress in 2004 All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN 978-1-59059-319-6 ISBN 978-1-4302-0721-4 (eBook) DOI 10.1007/978-1-4302-0721-4 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Technical Reviewers: Andrew Jenks, Kent Sharkey, Tom Miller Editorial Board: Steve Anglin, Dan Appleman, Gary Cornell, James Cox, Tony Davis, John Franklin, Chris Mills, Steve Rycroft, Dominic Shakeshaft, Julian Skinner, Jim Sumser, Karen Watterson, Gavin Wray, John Zukowski Assistant Publisher: Grace Wong Project Manager: Sofia Marchant Copy Editor: Ami Knox Production Manager: Kari Brooks Production Editor: JanetVail Proofreader: Patrick Vincent Compositor: ContentWorks Indexer: Rebecca Plunkett Artist: Kinetic Publishing Services, LLC Cover Designer: Kurt Krames Manufacturing Manager: Tom Debolski The information in this book is distributed on an "as is" basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work.
    [Show full text]
  • Directx 11 Extended to the Implementation of Compute Shader
    DirectX 1 DirectX About the Tutorial Microsoft DirectX is considered as a collection of application programming interfaces (APIs) for managing tasks related to multimedia, especially with respect to game programming and video which are designed on Microsoft platforms. Direct3D which is a renowned product of DirectX is also used by other software applications for visualization and graphics tasks such as CAD/CAM engineering. Audience This tutorial has been prepared for developers and programmers in multimedia industry who are interested to pursue their career in DirectX. Prerequisites Before proceeding with this tutorial, it is expected that reader should have knowledge of multimedia, graphics and game programming basics. This includes mathematical foundations as well. Copyright & Disclaimer Copyright 2019 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at [email protected]
    [Show full text]
  • NET Technology Guide for Business Applications // 1
    .NET Technology Guide for Business Applications Professional Cesar de la Torre David Carmona Visit us today at microsoftpressstore.com • Hundreds of titles available – Books, eBooks, and online resources from industry experts • Free U.S. shipping • eBooks in multiple formats – Read on your computer, tablet, mobile device, or e-reader • Print & eBook Best Value Packs • eBook Deal of the Week – Save up to 60% on featured titles • Newsletter and special offers – Be the first to hear about new releases, specials, and more • Register your book – Get additional benefits Hear about it first. Get the latest news from Microsoft Press sent to your inbox. • New and upcoming books • Special offers • Free eBooks • How-to articles Sign up today at MicrosoftPressStore.com/Newsletters Wait, there’s more... Find more great content and resources in the Microsoft Press Guided Tours app. The Microsoft Press Guided Tours app provides insightful tours by Microsoft Press authors of new and evolving Microsoft technologies. • Share text, code, illustrations, videos, and links with peers and friends • Create and manage highlights and notes • View resources and download code samples • Tag resources as favorites or to read later • Watch explanatory videos • Copy complete code listings and scripts Download from Windows Store Free ebooks From technical overviews to drilldowns on special topics, get free ebooks from Microsoft Press at: www.microsoftvirtualacademy.com/ebooks Download your free ebooks in PDF, EPUB, and/or Mobi for Kindle formats. Look for other great resources at Microsoft Virtual Academy, where you can learn new skills and help advance your career with free Microsoft training delivered by experts.
    [Show full text]
  • Release 343 Graphics Drivers for Windows, Version 344.48. RN
    Release 343 Graphics Drivers for Windows - Version 344.48 RN-W34448-01v02 | September 22, 2014 Windows Vista / Windows 7 / Windows 8 / Windows 8.1 Release Notes TABLE OF CONTENTS 1 Introduction to Release Notes ................................................... 1 Structure of the Document ........................................................ 1 Changes in this Edition ............................................................. 1 2 Release 343 Driver Changes ..................................................... 2 Version 344.48 Highlights .......................................................... 2 What’s New in Version 344.48 ................................................. 3 What’s New in Release 343..................................................... 5 Limitations in This Release ..................................................... 8 Advanced Driver Information ................................................. 10 Changes and Fixed Issues in Version 344.48.................................... 14 Open Issues in Version 344.48.................................................... 15 Windows Vista/Windows 7 32-bit Issues..................................... 15 Windows Vista/Windows 7 64-bit Issues..................................... 15 Windows 8 32-bit Issues........................................................ 17 Windows 8 64-bit Issues........................................................ 17 Windows 8.1 Issues ............................................................. 18 Not NVIDIA Issues..................................................................
    [Show full text]
  • Dell C8621QT Dell Display Manager User's Guide
    Dell C8621QT Dell Display Manager User’s Guide Model: C8621QT Regulatory model: C8621QTt NOTE: A NOTE indicates important information that helps you make better use of your computer. Copyright © 2020 Dell Inc. or its subsidiaries. All rights reserved. Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. Other trademarks may be trademarks of their respective owners. 2020 – 03 Rev. A00 Contents Overview .........................................4 Using the Quick Settings Dialog........................5 Setting Basic Display Functions........................6 Assigning Preset Modes to Applications .................7 Organizing Windows with Easy Arrange..................8 Managing Multiple Video Inputs.......................10 Restoring Application Positions ....................... 11 Applying Energy Conservation Features ................12 Other Shortcut Keys ...............................13 Attach DDM To Active Window (Only Window 10) .........14 Troubleshooting ...................................15 Contents | 3 Overview Dell Display Manager is a Microsoft Windows application used to manage a display or a group of displays. It enables manual adjustment of the displayed image, assignment of automatic settings, energy management, window organization, image rotation, and other features on selected Dell displays. After installed, Dell Display Manager runs each time the system starts and places its icon in the notification tray. Information about displays connected to the system is available when hovering over the notification-tray icon. Dell C8621QT - Standard NOTE: Dell Display Manager uses DDC/CI channel to communicate with your display. Ensure that DDC/CI is enabled in the menu as below. Dell 86 Monitor Brightness/Contrast Display Info Input Source DDC/CI On Color HDMI CEC O Display LCD Conditioning Audio Firmware Menu IP Address Personalize Service Tag Others Reset Others Factory Reset 4 | Overview Using the Quick Settings Dialog Clicking Dell Display Manager’s notification tray icon to open the Quick Settings dialog box.
    [Show full text]
  • Windows Programming Overview
    WINDOWS PROGRAMMING OVERVIEW IEEE Computer Society INTRODUCTION • Frank Hubbell • Hubbell Consulting • 585-392-5293 • [email protected][email protected] WINDOWS PRESENTATION FOUNDATION • Latest Windows Development Environment • Replaces Windows Forms? • Better Graphics • Better Multimedia Support • Different Kinds of Applications • Desktop • Web page • Web Application • Silverlight • Foundation For Other Environments WPF FEATURES Windows Windows Windows PDF Forms/ Direct3D WPF Forms Media Player GDI+ Graphical interface, e.g., forms and X X controls On-screen documents X X Fixed-format documents X X Images X X Video and audio X X Two-dimensional graphics X X Three-dimensional graphics X X MICROSOFT WINDOWS OPERATING SYSTEMS • 1985 Windows 1.0 • 1987 Windows 2.0 • 1990 Windows 3 • 1993 Windows NT • 1995 Windows 95 • 1998 Windows 98 • 1999 Windows 98SE • 2000 Windows ME • 2001 Windows XP • 2005 Windows Vista • 2009 Windows 7 MICROSOFT WINDOWS DEVELOPMENT PLATFORMS • WIN16 API • WIN32 API • Window Foundation Class (WFC) • .NET Window Forms (WinForms) • .NET Window Presentation Foundation (WPF) WINDOWS PROGRAMMING LANGUAGES • 1985 C or VB Windows Application Program Interface (API) • 1992 C++ or VB Microsoft Foundation Class (MFC) library • 2001 C# or C++ Windows Forms (.NET Framework) or VB • 2006 C# or VB Windows Presentation Foundation (WPF) VISUAL BASIC • Are you now, or have you ever been a basic programmer? MICROSOFT ARCHITECTURE FIRST DEMONSTRATION • Creating a default application in Visual Studio 2010 • Half Code, Half XAML
    [Show full text]
  • Remote Console Switch Software User's Guide (On CD) • 2161DS Console Switch Installation Instructions • Download Instructions
    Dell™ 2161DS Console Switch Remote Console Switch Software User’s Guide Model: 2161DS Console Switch www.dell.com | support.dell.com Notes and Cautions Notes, Notices, and Cautions NOTE: A NOTE indicates important information that helps you make better use of your computer. NOTICE: A NOTICE indicates either potential damage to hardware or loss of data and tells you how to avoid the problem. CAUTION: A CAUTION indicates a potential for property damage, personal injury, or death. ___________________ Information in this document is subject to change without notice. © 2004 Dell Inc. All rights reserved. Reproduction in any manner whatsoever without the written permission of Dell Inc. is strictly forbidden. Trademarks used in this text: Avocent is a registered trademarks of Avocent Corporation. OSCAR is a registered trademark of Avocent Corporation or its affiliates.Dell, Dell OpenManage, and the DELL logo are trademarks of Dell Inc.; Microsoft, Windows, and Windows NT are registered trademarks of Microsoft Corporation; Intel and Pentium are registered trademarks of Intel Corporation; Red Hat is a registered trademark of Red Hat, Inc. Other trademarks and trade names may be used in this document to refer to either the entities claiming the marks and names or their products. Dell Inc. disclaims any proprietary interest in trademarks and trade names other than its own. Model 2161DS Console Switch July 2004 Contents 1 Product Overview About the Remote Console Switch Software . 11 Features and Benefits . 11 Easy to Install and Configure. 11 Powerful Customization Capabilities . 11 Extensive Remote Console Switch Management . 11 Interoperability with Avocent Products . 12 2 Installation Getting Started .
    [Show full text]
  • IDEA 3.4.4 Readme File
    IDEA 3.4.4 Readme File README for Foresight Imaging IDEA V3.4.4, January 31, 2018 This release is provided as an online download or on a single CD for both Windows 7 and Windows 10 32 bit & 64 bit operating systems. IDEA v3.4.4 for 32 Bit & 64 bit OS, CD part number: 042700-344 Uninstall previous versions of IDEA prior to installing version 3.4.4 Please note that product documentation is provided in electronic format only. You will need the Adobe Acrobat Reader version 8.0 or higher to view the documentation. Adobe Acrobat can be downloaded at either: www.adobe.com or www.fi-llc.com The IDEA software and hardware installation manuals are located on the CD and in the C:\Program Files\Foresight\IDEA\Doc directory (after installation) as SDK_Manual.pdf & Install_Manual.pdf. A demonstration version of the Accusoft / Pegasus Imaging MJPEG codec is included for use with the example programs. For information on licensing this software, please go to: https://www.accusoft.com/products/picvideo-m-jpeg-codec/overview/ IDEA Active X Demo Using Visual Basic, StreamCap and IDEA API Example Program are the three example programs recommended for use to evaluate the full functionality of the frame grabbers and video streamers. They are included in: Start || Programs || Foresight || Demos. VideoTest is a test program to verify the system's ability to create a live direct draw surface for display. For Windows 7 32 bit installations only: Start || Programs || Foresight || Demos StreamCap is the demonstration program recommended for use of the WDM driver.
    [Show full text]
  • High Performance Visualization Through Graphics Hardware and Integration Issues in an Electric Power Grid Computer-Aided-Design Application
    UNIVERSITY OF A CORUÑA FACULTY OF INFORMATICS Department of Computer Science Ph.D. Thesis High performance visualization through graphics hardware and integration issues in an electric power grid Computer-Aided-Design application Author: Javier Novo Rodríguez Advisors: Elena Hernández Pereira Mariano Cabrero Canosa A Coruña, June, 2015 August 27, 2015 UNIVERSITY OF A CORUÑA FACULTY OF INFORMATICS Campus de Elviña s/n 15071 - A Coruña (Spain) Copyright notice: No part of this publication may be reproduced, stored in a re- trieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording and/or other- wise without the prior permission of the authors. Acknowledgements I would like to thank Gas Natural Fenosa, particularly Ignacio Manotas, for their long term commitment to the University of A Coru˜na. This research is a result of their funding during almost five years through which they carefully balanced business-driven objectives with the freedom to pursue more academic goals. I would also like to express my most profound gratitude to my thesis advisors, Elena Hern´andez and Mariano Cabrero. Elena has also done an incredible job being the lead coordinator of this collaboration between Gas Natural Fenosa and the University of A Coru˜na. I regard them as friends, just like my other colleagues at LIDIA, with whom I have spent so many great moments. Thank you all for that. Last but not least, I must also thank my family – to whom I owe everything – and friends. I have been unbelievably lucky to meet so many awesome people in my life; every single one of them is part of who I am and contributes to whatever I may achieve.
    [Show full text]
  • Focus on SDL.Pdf
    00 FO SDL Frontmatter 10/21/02 11:52 AM Page i Focus On SDL Ernest Pazera Team LRN 00 FO SDL Frontmatter 10/21/02 11:52 AM Page ii © 2003 by Premier Press, a division of Course Technology. All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system without written permission from Premier Press, except for the inclusion of brief quotations in a review. The Premier Press logo and related trade dress are trademarks of Premier Press, Inc. and may not be used without written permission. All other trade- marks are the property of their respective owners. Publisher: Stacy L. Hiquet Marketing Manager: Heather Buzzingham Managing Editor: Heather Talbot Acquisitions Editor: Emi Smith Project Editor/Copy Editor: Cathleen Snyder Technical Reviewer: André LaMothe Interior Layout: Shawn Morningstar Cover Design: Mike Tanamachi Indexer: Sharon Shock Proofreader: Jenny Davidson Microsoft, Windows, DirectDraw, DirectMusic, DirectPlay, DirectSound, DirectX, Visual C++, Xbox, and/or other Microsoft products referenced herein are either registered trademarks or trademarks of Microsoft Corporation in the U.S. and/or other countries. All other trademarks are the property of their respective owners. Important: Premier Press cannot provide software support. Please contact the appropriate software manufacturer’s technical support line or Web site for assistance. Premier Press and the author have attempted throughout this book to distinguish proprietary trademarks from descriptive terms by following the capitalization style used by the manufacturer. Information contained in this book has been obtained by Premier Press from sources believed to be reliable.
    [Show full text]