Opengl® Shading Language Third Edition

Total Page:16

File Type:pdf, Size:1020Kb

Opengl® Shading Language Third Edition OpenGL® Shading Language Third Edition Rand! J. Rost Bill Licea-Kane With cmnfilmtions by Dan Ginsburg, John ivL KesseniA, Barthold Lichtenbelt, Hugh Malan, and Mike Weible,i Ar Addison-Wesley Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munieh • Paris • Madrid Capetown • Sydney • Tokyo • Singapore • Mexico City Contents Foreword to the Second Edition xxi Foreword to the First Edition xxv Preface xxix About the Authors xxxv About the Contributors xxxvii Acknowledgments xxxix Chapter 1. Review of OpenGL Basics 1 1.1 OpenGL History 1 1.2 OpenGL Evolution 4 1.3 Execution Model 5 1.4 The Framebuffer 6 1.5 State 9 1.6 Processing Pipeline 9 1.7 Drawing Geometry 11 1.7.1 Geometry Specification 11 1.7.2 Per-Vertex Operations 13 1.7.3 Primitive Assembly 15 1.7.4 Primitive Processing 15 1.7.5 Rasterization 16 1.7.6 Fragment Processing 17 1.7.7 Per-Fragment Operations 18 1.7.8 Framebuffer Operations 18 1.8 Drawing Images 19 1.8.1 Pixel Unpacking 20 X Contents 1.8.2 Pixel Transfer 20 1.8.3 Rasterization and Back-End Processing 21 1.8.4 Read Control 22 1.9 Coordinate Transforms 22 1.10 Texturing 27 1.11 Summary 33 1.12 Further Information 33 Chapter 2. Basics 35 2.1 Introduction to the OpenGL Shading Language 35 2.2 Why Write Shaders? 37 2.3 OpenGL Programmable Processors 38 2.3.1 Vertex Processor 40 2.3.2 Fragment Processor 43 2.4 Language Overview 47 2.4.1 Language Design Considerations 47 2.4.2 C Basis 50 2.4.3 Additions to C 50 2.4.4 Additions from C++ 52 2.4.5 C Features Not Supported 53 2.4.6 Other Differences 53 2.5 System Overview 54 2.5.1 Driver Model 54 2.5.2 OpenGL Shading Language Compiler/Linker 56 2.5.3 OpenGL Shading Language API 57 2.6 Key Benefits 59 2.7 Summary 61 2.8 Further Information 63 Chapter 3. Language Definition 65 3.1 Example Shader Pair 65 3.2 Data Types 67 3.2.1 Scalars 68 3.2.2 Vectors 69 3.2.3 Matrices 70 3.2.4 Samplers 71 3.2.5 Structures 73 3.2.6 Arrays 74 3.2.7 Void 75 Contents Xi 3.2.8 Declarations and Scope 75 3.2.9 Type Matching and Promotion 76 3.3 Initializers and Constructors 76 3.4 Type Conversions 78 3.5 Qualifiers and Interface to a Shader 79 3.5.1 Uniform Qualifiers 80 3.5.2 Uniform Blocks 81 3.5.3 In Qualifiers (Vertex Shader) 82 3.5.4 Out Qualifiers (Vertex Shader) 82 3.5.5 In Qualifiers (Fragment Shader) 83 3.5.6 Out Qualifiers (Fragment Shader) 83 3.5.7 Constant Qualifiers 83 3.5.8 Absent Qualifier 84 3.6 Flow Control 84 3.6.1 Functions 85 3.6.2 Calling Conventions 86 3.6.3 Built-in Functions 87 3.7 Operations 88 3.7.1 Indexing 89 3.7.2 Swizzling 90 3.7.3 Component-wise Operation 90 3.8 Preprocessor 93 3.9 Preprocessor Expressions 96 3.10 Error Handling 97 3.11 Summary 98 3.12 Further Information 98 Chapter 4. The OpenGL Programmable Pipeline 101 4.1 The Vertex Processor 102 4.1.1 Vertex Attributes 103 4.1.2 Special Input Variables 104 4.1.3 Uniform Variables 104 4.1.4 User-Defined Out Variables 104 4.1.5 Special Output Variables 105 4.2 The Fragment Processor 106 4.2.1 User-Defined In Variables 107 4.2.2 Special Input Variables 107 4.2.3 Uniform Variables 108 4.2.4 User-Defined Out Variables 108 4.2.5 Special Output Variables 109 xi i Contents 4.3 Built-in Uniform Variables 110 4.4 Built-in Constants 110 4.5 Interaction with OpenGL Fixed Functionality 111 4.5.1 Point Size Mode 111 4.5.2 Clipping 112 4.5.3 Position Invariance 113 4.5.4 Texturing 113 4.6 Summary 115 4.7 Further Information 115 Chapter 5. Built-in Functions 117 5.1 Angle and Trigonometry Functions 118 5.2 Exponential Functions 121 5.3 Common Functions 122 5.4 Geometric Functions 134 5.5 Matrix Functions 136 5.6 Vector Relational Functions 138 5.7 Texture Access Functions 140 5.8 Fragment Processing Functions 176 5.9 Noise Functions 177 5.10 Summary 178 5.11 Further Information 178 Chapter 6. Simple Shading Example 181 6.1 Brick Shader Overview 182 6.2 Vertex Shader 183 6.3 Fragment Shader 189 6.4 Observations 196 6.5 Summary 197 6.6 Further Information 197 Chapter 7. OpenGL Shading Language API 199 7.1 Obtaining Version Information 200 7.2 Creating Shader Objects 203 7.3 Compiling Shader Objects 204 7.4 Linking and Using Shaders 205 7.5 Cleaning Up 210 7.6 Query Functions 211 7.7 Specifying Vertex Attributes 217 Contents Xiii 7.8 Specifying Uniform Variables 226 7.8.1 Default Uniform Block 227 7.8.2 Named Uniform Blocks 234 7.9 Samplers 238 7.10 Multiple Render Targets 239 7.11 Development Aids 240 7.12 Implementation-Dependent API Values 241 7.13 Application Code for Brick Shaders 242 7.14 Summary 247 7.15 Further Information 248 Chapter 8. Shader Development 251 8.1 General Principles 251 8.1.1 Understand the Problem 252 8.1.2 Add Complexity Progressively 252 8.1.3 Test and Iterate 253 8.1.4 Strive for Simplicity 253 8.1.5 Exploit Modularity 253 8.2 Performance Considerations 254 8.2.1 Consider Computational Frequency 254 8.2.2 Analyze Your Algorithm 255 8.2.3 Use the Built-in Functions 255 8.2.4 Use Vectors 255 8.2.5 Use Textures to Encode Complex Functions 256 8.2.6 Review the Information Logs 256 8.3 Shader Debugging 256 8.3.1 Use the Vertex Shader Output 256 8.3.2 Use the Fragment Shader Output 257 8.3.3 Use Simple Geometry 258 8.4 Shader Development Tools 258 8.4.1 RenderMonkey 258 8.4.2 Apple GLSLEditorSample 261 8.4.3 Graphic Remedy gDEBugger 261 8.4.4 OpenGL Shading Language Compiler Front End . 261 8.5 Scene Graphs 263 8.6 Summary 266 8.7 Further Information 266 Xiv Contents Chapter 9. Emulating OpenGL Fixed Functionality 269 9.1 Transformation 270 9.2 Light Sources 273 9.2.1 Directional Lights 273 9.2.2 Point Lights 274 9.2.3 Spotlights 276 9.3 Material Properties and Lighting 277 9.4 Two-Sided Lighting 279 9.5 No Lighting 280 9.6 Fog 281 9.7 Texture Coordinate Generation 283 9.8 User Clipping 286 9.9 Texture Application 286 9.10 Matrices 288 9.10.1 Identity Matrix 288 9.10.2 Scale 288 9.10.3 Translate 289 9.10.4 Rotate 289 9.10.5 Ortho 290 9.10.6 Frustum 290 9.11 Operating an the Current Matrices 291 9.11.1 A Simple Matrix Transformation Example 293 9.12 Summary 294 9.13 Further Information 294 Chapter 10. Stored Texture Shaders 297 10.1 Access to Texture Maps from a Shader 298 10.2 Simple Texturing Example 300 10.2.1 Application Setup 301 10.2.2 Vertex Shader 302 10.2.3 Fragment Shader 303 10.3 Multitexturing Example 303 10.3.1 Application Setup 305 10.3.2 Vertex Shader 306 10.3.3 Fragment Shader 307 10.4 Cube Mapping Example 309 10.4.1 Application Setup 310 10.4.2 Vertex Shader 310 10.4.3 Fragment Shader 311 Contents xv 10.5 Another Environment Mapping Example 312 10.5.1 Vertex Shader 313 10.5.2 Fragment Shader 314 10.6 Glyph Bombing 316 10.6.1 Application Setup 317 10.6.2 Vertex Shader 321 10.6.3 Fragment Shader 322 10.7 Summary 326 10.8 Further Information 326 Chapter 11. Procedural Texture Shaders 329 11.1 Regular Patterns 331 11.1.1 Stripes Vertex Shader 333 11.1.2 Stripes Fragment Shader 334 11.2 Toy Ball 336 11.2.1 Application Setup 337 11.2.2 Vertex Shader 338 11.2.3 Fragment Shader 339 11.3 Lattice 344 11.4 Bump Mapping 345 11.4.1 Application Setup 348 11.4.2 Vertex Shader 350 11.4.3 Fragment Shader 351 11.4.4 Normal Maps 353 11.5 Summary 354 11.6 Further Information 354 Chapter 12. Lighting 357 12.1 Hemisphere Lighting 357 12.2 Image-Based Lighting 361 12.3 Lighting with Spherical Harmonics 365 12.4 The Überlight Shader 369 12.4.1 Überlight Controls 369 12.4.2 Vertex Shader 372 12.4.3 Fragment Shader 373 12.5 Summary 376 12.6 Further Information 376 xvi Contents Chapter 13. Shadows 379 13.1 Ambient Occlusion 380 13.2 Shadow Maps 385 13.2.1 Application Setup 387 13.2.2 Vertex Shader 388 13.2.3 Fragment Shader 389 13.3 Deferred Shading for Volume Shadows 392 13.3.1 Shaders for First Pass 395 13.3.2 Shaders for Second Pass 396 13.4 Summary 400 13.5 Further Information 400 Chapter 14. Surface Characteristics 403 14.1 Refraction 404 14.2 Diffraction 410 14.3 BRDF Models 415 14.4 Polynomial Texture Mapping with BRDF Data 422 14.4.1 Application Setup 425 14.4.2 Vertex Shader 426 14.4.3 Fragment Shader 429 14.5 Summary 431 14.6 Further Information 432 Chapter 15.
Recommended publications
  • Introduction to the Vulkan Computer Graphics API
    1 Introduction to the Vulkan Computer Graphics API Mike Bailey mjb – July 24, 2020 2 Computer Graphics Introduction to the Vulkan Computer Graphics API Mike Bailey [email protected] SIGGRAPH 2020 Abridged Version This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License http://cs.oregonstate.edu/~mjb/vulkan ABRIDGED.pptx mjb – July 24, 2020 3 Course Goals • Give a sense of how Vulkan is different from OpenGL • Show how to do basic drawing in Vulkan • Leave you with working, documented, understandable sample code http://cs.oregonstate.edu/~mjb/vulkan mjb – July 24, 2020 4 Mike Bailey • Professor of Computer Science, Oregon State University • Has been in computer graphics for over 30 years • Has had over 8,000 students in his university classes • [email protected] Welcome! I’m happy to be here. I hope you are too ! http://cs.oregonstate.edu/~mjb/vulkan mjb – July 24, 2020 5 Sections 13.Swap Chain 1. Introduction 14.Push Constants 2. Sample Code 15.Physical Devices 3. Drawing 16.Logical Devices 4. Shaders and SPIR-V 17.Dynamic State Variables 5. Data Buffers 18.Getting Information Back 6. GLFW 19.Compute Shaders 7. GLM 20.Specialization Constants 8. Instancing 21.Synchronization 9. Graphics Pipeline Data Structure 22.Pipeline Barriers 10.Descriptor Sets 23.Multisampling 11.Textures 24.Multipass 12.Queues and Command Buffers 25.Ray Tracing Section titles that have been greyed-out have not been included in the ABRIDGED noteset, i.e., the one that has been made to fit in SIGGRAPH’s reduced time slot.
    [Show full text]
  • GLSL 4.50 Spec
    The OpenGL® Shading Language Language Version: 4.50 Document Revision: 7 09-May-2017 Editor: John Kessenich, Google Version 1.1 Authors: John Kessenich, Dave Baldwin, Randi Rost Copyright (c) 2008-2017 The Khronos Group Inc. All Rights Reserved. This specification is protected by copyright laws and contains material proprietary to the Khronos Group, Inc. It or any components may not be reproduced, republished, distributed, transmitted, displayed, broadcast, or otherwise exploited in any manner without the express prior written permission of Khronos Group. You may use this specification for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. Khronos Group grants express permission to any current Promoter, Contributor or Adopter member of Khronos to copy and redistribute UNMODIFIED versions of this specification in any fashion, provided that NO CHARGE is made for the specification and the latest available update of the specification for any version of the API is used whenever possible. Such distributed specification may be reformatted AS LONG AS the contents of the specification are not changed in any way. The specification may be incorporated into a product that is sold as long as such product includes significant independent work developed by the seller. A link to the current version of this specification on the Khronos Group website should be included whenever possible with specification distributions.
    [Show full text]
  • Opencl on the GPU San Jose, CA | September 30, 2009
    OpenCL on the GPU San Jose, CA | September 30, 2009 Neil Trevett and Cyril Zeller, NVIDIA Welcome to the OpenCL Tutorial! • Khronos and industry perspective on OpenCL – Neil Trevett Khronos Group President OpenCL Working Group Chair NVIDIA Vice President Mobile Content • NVIDIA and OpenCL – Cyril Zeller NVIDIA Manager of Compute Developer Technology Khronos and the OpenCL Standard Neil Trevett OpenCL Working Group Chair, Khronos President NVIDIA Vice President Mobile Content Copyright Khronos 2009 Who is the Khronos Group? • Consortium creating open API standards ‘by the industry, for the industry’ – Non-profit founded nine years ago – over 100 members - any company welcome • Enabling software to leverage silicon acceleration – Low-level graphics, media and compute acceleration APIs • Strong commercial focus – Enabling members and the wider industry to grow markets • Commitment to royalty-free standards – Industry makes money through enabled products – not from standards themselves Silicon Community Software Community Copyright Khronos 2009 Apple Over 100 companies creating authoring and acceleration standards Board of Promoters Processor Parallelism CPUs GPUs Multiple cores driving Emerging Increasingly general purpose performance increases Intersection data-parallel computing Improving numerical precision Multi-processor Graphics APIs programming – Heterogeneous and Shading e.g. OpenMP Computing Languages Copyright Khronos 2009 OpenCL Commercial Objectives • Grow the market for parallel computing • Create a foundation layer for a parallel
    [Show full text]
  • History and Evolution of the Android OS
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by Springer - Publisher Connector CHAPTER 1 History and Evolution of the Android OS I’m going to destroy Android, because it’s a stolen product. I’m willing to go thermonuclear war on this. —Steve Jobs, Apple Inc. Android, Inc. started with a clear mission by its creators. According to Andy Rubin, one of Android’s founders, Android Inc. was to develop “smarter mobile devices that are more aware of its owner’s location and preferences.” Rubin further stated, “If people are smart, that information starts getting aggregated into consumer products.” The year was 2003 and the location was Palo Alto, California. This was the year Android was born. While Android, Inc. started operations secretly, today the entire world knows about Android. It is no secret that Android is an operating system (OS) for modern day smartphones, tablets, and soon-to-be laptops, but what exactly does that mean? What did Android used to look like? How has it gotten where it is today? All of these questions and more will be answered in this brief chapter. Origins Android first appeared on the technology radar in 2005 when Google, the multibillion- dollar technology company, purchased Android, Inc. At the time, not much was known about Android and what Google intended on doing with it. Information was sparse until 2007, when Google announced the world’s first truly open platform for mobile devices. The First Distribution of Android On November 5, 2007, a press release from the Open Handset Alliance set the stage for the future of the Android platform.
    [Show full text]
  • Webgl™ Optimizations for Mobile
    WebGL™ Optimizations for Mobile Lorenzo Dal Col Senior Software Engineer, ARM 1 Agenda 1. Introduction to WebGL™ on mobile . Rendering Pipeline . Locate the bottleneck 2. Performance analysis and debugging tools for WebGL . Generic optimization tips 3. PlayCanvas experience . WebGL Inspector 4. Use case: PlayCanvas Swooop . ARM® DS-5 Streamline . ARM Mali™ Graphics Debugger 5. Q & A 2 Bring the Power of OpenGL® ES to Mobile Browsers What is WebGL™? Why WebGL? . A cross-platform, royalty free web . It brings plug-in free 3D to the web, standard implemented right into the browser. Low-level 3D graphics API . Major browser vendors are members of . Based on OpenGL® ES 2.0 the WebGL Working Group: . A shader based API using GLSL . Apple (Safari® browser) . Mozilla (Firefox® browser) (OpenGL Shading Language) . Google (Chrome™ browser) . Opera (Opera™ browser) . Some concessions made to JavaScript™ (memory management) 3 Introduction to WebGL™ . How does it fit in a web browser? . You use JavaScript™ to control it. Your JavaScript is embedded in HTML5 and uses its Canvas element to draw on. What do you need to start creating graphics? . Obtain WebGLrenderingContext object for a given HTMLCanvasElement. It creates a drawing buffer into which the API calls are rendered. For example: var canvas = document.getElementById('canvas1'); var gl = canvas.getContext('webgl'); canvas.width = newWidth; canvas.height = newHeight; gl.viewport(0, 0, canvas.width, canvas.height); 4 WebGL™ Stack What is happening when a WebGL page is loaded . User enters URL . HTTP stack requests the HTML page Browser . Additional requests will be necessary to get Space User JavaScript™ code and other resources WebKit JavaScript Engine .
    [Show full text]
  • Rowpro Graphics Tester Instructions
    RowPro Graphics Tester Instructions What is the RowPro Graphics Tester? The RowPro Graphics Tester is a handy utility to quickly check and confirm RowPro 3D graphics and live water will run in your PC. Do I need to test my PC graphics? If any of the following are true you should test your PC graphics before installing or upgrading to RowPro 3: If your PC shipped new with Windows XP. If you are about to upgrade from RowPro version 2. If you have any doubts or concerns about your PC graphics system. How to download and install the RowPro Graphics Tester Click the link above to download the tester file RowProGraphicsTest.exe. In the download dialog box that appears, click Save or Save this program to disk, navigate to the folder where you want to save the download, and click OK to start the download. IMPORTANT NOTE: The RowPro Graphics Tester only tests if your PC has the required graphics components installed, it is not a graphics performance test. Passing the RowPro Graphics Test is not a guarantee that your PC will run RowPro at a frame rate that is fast enough to be useful. It is however an important test to confirm your PC is at least equipped with the necessary graphics components. How to run the RowPro Graphics Tester 1. Run RowProGraphicsTest.exe to run the test. The test normally completes in less than a second. 2. If any of the results show 'No', check the solutions below. 3. Click the x at the top right of the test panel to close the test.
    [Show full text]
  • Opengl Shading Languag 2Nd Edition (Orange Book)
    OpenGL® Shading Language, Second Edition By Randi J. Rost ............................................... Publisher: Addison Wesley Professional Pub Date: January 25, 2006 Print ISBN-10: 0-321-33489-2 Print ISBN-13: 978-0-321-33489-3 Pages: 800 Table of Contents | Index "As the 'Red Book' is known to be the gold standard for OpenGL, the 'Orange Book' is considered to be the gold standard for the OpenGL Shading Language. With Randi's extensive knowledge of OpenGL and GLSL, you can be assured you will be learning from a graphics industry veteran. Within the pages of the second edition you can find topics from beginning shader development to advanced topics such as the spherical harmonic lighting model and more." David Tommeraasen, CEO/Programmer, Plasma Software "This will be the definitive guide for OpenGL shaders; no other book goes into this detail. Rost has done an excellent job at setting the stage for shader development, what the purpose is, how to do it, and how it all fits together. The book includes great examples and details, and good additional coverage of 2.0 changes!" Jeffery Galinovsky, Director of Emerging Market Platform Development, Intel Corporation "The coverage in this new edition of the book is pitched just right to help many new shader- writers get started, but with enough deep information for the 'old hands.'" Marc Olano, Assistant Professor, University of Maryland "This is a really great book on GLSLwell written and organized, very accessible, and with good real-world examples and sample code. The topics flow naturally and easily, explanatory code fragments are inserted in very logical places to illustrate concepts, and all in all, this book makes an excellent tutorial as well as a reference." John Carey, Chief Technology Officer, C.O.R.E.
    [Show full text]
  • Migrating from Opengl to Vulkan Mark Kilgard, January 19, 2016 About the Speaker Who Is This Guy?
    Migrating from OpenGL to Vulkan Mark Kilgard, January 19, 2016 About the Speaker Who is this guy? Mark Kilgard Principal Graphics Software Engineer in Austin, Texas Long-time OpenGL driver developer at NVIDIA Author and implementer of many OpenGL extensions Collaborated on the development of Cg First commercial GPU shading language Recently working on GPU-accelerated vector graphics (Yes, and wrote GLUT in ages past) 2 Motivation for Talk Coming from OpenGL, Preparing for Vulkan What kinds of apps benefit from Vulkan? How to prepare your OpenGL code base to transition to Vulkan How various common OpenGL usage scenarios are re-thought in Vulkan Re-thinking your application structure for Vulkan 3 Analogy Different Valid Approaches 4 Analogy Fixed-function OpenGL Pre-assembled toy car fun out of the box, not much room for customization 5 AZDO = Approaching Zero Driver Overhead Analogy Modern AZDO OpenGL with Programmable Shaders LEGO Kit you build it yourself, comes with plenty of useful, pre-shaped pieces 6 Analogy Vulkan Pine Wood Derby Kit you build it yourself to race from raw materials power tools used to assemble, adult supervision highly recommended 7 Analogy Different Valid Approaches Fixed-function OpenGL Modern AZDO OpenGL with Vulkan Programmable Shaders 8 Beneficial Vulkan Scenarios Has Parallelizable CPU-bound Graphics Work yes Can your graphics Is your graphics work start work creation be CPU bound? parallelized? yes Vulkan friendly 9 Beneficial Vulkan Scenarios Maximizing a Graphics Platform Budget You’ll yes do whatever Your graphics start it takes to squeeze platform is fixed out max perf. yes Vulkan friendly 10 Beneficial Vulkan Scenarios Managing Predictable Performance, Free of Hitching You put yes You can a premium on manage your start avoiding graphics resource hitches allocations yes Vulkan friendly 11 Unlikely to Benefit Scenarios to Reconsider Coding to Vulkan 1.
    [Show full text]
  • Opengl 4.0 Shading Language Cookbook
    OpenGL 4.0 Shading Language Cookbook Over 60 highly focused, practical recipes to maximize your use of the OpenGL Shading Language David Wolff BIRMINGHAM - MUMBAI OpenGL 4.0 Shading Language Cookbook Copyright © 2011 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: July 2011 Production Reference: 1180711 Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-849514-76-7 www.packtpub.com Cover Image by Fillipo ([email protected]) Credits Author Project Coordinator David Wolff Srimoyee Ghoshal Reviewers Proofreader Martin Christen Bernadette Watkins Nicolas Delalondre Indexer Markus Pabst Hemangini Bari Brandon Whitley Graphics Acquisition Editor Nilesh Mohite Usha Iyer Valentina J. D’silva Development Editor Production Coordinators Chris Rodrigues Kruthika Bangera Technical Editors Adline Swetha Jesuthas Kavita Iyer Cover Work Azharuddin Sheikh Kruthika Bangera Copy Editor Neha Shetty About the Author David Wolff is an associate professor in the Computer Science and Computer Engineering Department at Pacific Lutheran University (PLU).
    [Show full text]
  • Introduction to Computer Graphics with Webgl
    Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015 1 Models and Architectures Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015 2 Objectives • Learn the basic design of a graphics system • Introduce pipeline architecture • Examine software components for an interactive graphics system Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015 3 Image Formation Revisited • Can we mimic the synthetic camera model to design graphics hardware software? • Application Programmer Interface (API) - Need only specify • Objects • Materials • Viewer • Lights • But how is the API implemented? Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015 4 Physical Approaches • Ray tracing: follow rays of light from center of projection until they either are absorbed by objects or go off to infinity - Can handle global effects • Multiple reflections • Translucent objects - Slow - Must have whole data base available at all times • Radiosity: Energy based approach - Very slow Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015 5 Practical Approach • Process objects one at a time in the order they are generated by the application - Can consider only local lighting • Pipeline architecture application display program • All steps can be implemented in hardware on the graphics
    [Show full text]
  • Opengl Install Guide
    OpenGL Install Guide Windows Install your favorite IDE. This tutorial assumes that you have Microsoft Visual Studio 6.0 (available from the CS Department Software Library as of Autumn 2004) installed on your machine. See specific IDE guides at the end of this document for more information. Install OpenGL OpenGL v1.1 software runtime is included as part of operating system for WinXP, Windows 2000, Windows 98, Windows 95 (OSR2) and Windows NT. If you think your copy is missing, the OpenGL v1.1 libraries are also available as the self- extracting archive file from the Microsoft website, via this url: http://download.microsoft.com/download/win95upg/info/1/W95/EN-US/Opengl95.exe OpenGL Libraries and header files are • opengl32.lib • glu32.lib • gl.h • glu.h Install GLUT GLUT is not normally pre-installed. You can download it from: http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip Install GLUT by following the instructions in the README file (copy and pasted here): Copy the files: 1. glut32.dll to %WinDir%\System, 2. glut32.lib to $(MSDevDir)\..\..\VC98\lib 3. glut.h to $(MSDevDir)\..\..\VC98\include\GL. Use OpenGL & GLUT in your source code 1. Start Visual C++ and create a new empty project of type “Win32 Console Application.” 2. To test your setup, add a simple GLUT program to the project like “drawCircle.cpp” from our sample programs. 3. You should only need to #include <GL/glut.h>. It includes the other necessary dependent libraries. You might need to modify our example programs to fit this requirement.
    [Show full text]
  • An Introduction to Openvg™ FTF-AUT-F0465
    An Introduction to OpenVG™ FTF-AUT-F0465 Oliver Tian | Auto FAE M A Y . 2 0 1 4 TM External Use Agenda • Trend of Graphics in Vehicle • Roadmap of Cluster • Introduction of Rainbow/Vybrid • OpenVG Scenario • Development Ecosystem • Conclusion TM External Use 1 Trend of Graphics in Vehicle TM External Use 2 The Connected Vehicle Infotainment + Communication + Security • Consumer electronics trends are dictating features in the car • Always connected, applications driven, advanced graphics • Infotainment systems becoming battleground for Auto differentiation • As more connected systems get introduced into the vehicle, the need for security is critical − Increasing external communication features (Bluetooth, TPMS, Ethernet, Wi-Fi, etc). − Future interface for vehicle-to-vehicle and vehicle-to-infrastructure. TM External Use 3 Mobility for Everyone Affordable Solutions for Emerging Markets • 100M vehicles annually forecasted before 2020, on top of motorcycle & e-bike growth • 80% of quantity growth after 2015 happening in emerging markets • Safety and emissions reduction are key for a sustainable development Source: IHS Automotive, February 2014 TM External Use 4 More, More, More for Less, Less, Less More performance, more embedded memory, more safety for less cost, less power and less development effort More • Electronic complexity • ECUs per car (50+) • MCUs per car (100+) • In-car Wi-Fi ® (7.2Mbps and 3.7Bpcs by 2017) iSuppli Less Reuse • Other markets have less critical applications • Some automotive specific challenges TM External Use 5 Today’s Car • Complex computerized control − Millions of lines of code, from multiple vendors − Dozens of distinct ECUs, from multiple vendors • Shared internal networking (e.g., CAN, FlexRay) − Increasing external communications features .
    [Show full text]