Opengl Programming Guide for Mac OS X

Total Page:16

File Type:pdf, Size:1020Kb

Opengl Programming Guide for Mac OS X OpenGL Programming Guide for Mac OS X 2006-10-03 Intel and Intel Core are registered Apple Computer, Inc. trademarks of Intel Corportation or its © 2004, 2006 Apple Computer, Inc. subsidiaries in the United States and other All rights reserved. countries. OpenGL is a registered trademark of Silicon No part of this publication may be Graphics, Inc. reproduced, stored in a retrieval system, or transmitted, in any form or by any means, PowerPC and and the PowerPC logo are mechanical, electronic, photocopying, trademarks of International Business recording, or otherwise, without prior Machines Corporation, used under license written permission of Apple Computer, Inc., therefrom. with the following exceptions: Any person X Window System is a trademark of the is hereby authorized to store documentation Massachusetts Institute of Technology. on a single computer for personal use only Simultaneously published in the United and to print copies of documentation for States and Canada. personal use provided that the documentation contains Apple’s copyright Even though Apple has reviewed this document, APPLE MAKES NO WARRANTY OR notice. REPRESENTATION, EITHER EXPRESS OR IMPLIED, WITH RESPECT TO THIS The Apple logo is a trademark of Apple DOCUMENT, ITS QUALITY, ACCURACY, Computer, Inc. MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. AS A RESULT, THIS Use of the “keyboard” Apple logo DOCUMENT IS PROVIDED “AS IS,” AND YOU, THE READER, ARE ASSUMING THE (Option-Shift-K) for commercial purposes ENTIRE RISK AS TO ITS QUALITY AND without the prior written consent of Apple ACCURACY. may constitute trademark infringement and IN NO EVENT WILL APPLE BE LIABLE FOR unfair competition in violation of federal DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES and state laws. RESULTING FROM ANY DEFECT OR INACCURACY IN THIS DOCUMENT, even if No licenses, express or implied, are granted advised of the possibility of such damages. with respect to any of the technology THE WARRANTY AND REMEDIES SET described in this document. Apple retains FORTH ABOVE ARE EXCLUSIVE AND IN LIEU OF ALL OTHERS, ORAL OR WRITTEN, all intellectual property rights associated EXPRESS OR IMPLIED. No Apple dealer, agent, with the technology described in this or employee is authorized to make any document. This document is intended to modification, extension, or addition to this warranty. assist application developers to develop Some states do not allow the exclusion or applications only for Apple-labeled or limitation of implied warranties or liability for Apple-licensed computers. incidental or consequential damages, so the above limitation or exclusion may not apply to Every effort has been made to ensure that you. This warranty gives you specific legal rights, and you may also have other rights which the information in this document is vary from state to state. accurate. Apple is not responsible for typographical errors. Apple Computer, Inc. 1 Infinite Loop Cupertino, CA 95014 408-996-1010 Apple, the Apple logo, Carbon, Cocoa, ColorSync, iPhoto, Logic, Mac, Mac OS, Macintosh, Quartz, and Xcode are trademarks of Apple Computer, Inc., registered in the United States and other countries. Finder is a trademark of Apple Computer, Inc. Objective-C is a registered trademark of NeXT Software, Inc. Contents Introduction Introduction to OpenGL Programming Guide for Mac OS X 11 Who Should Read This Document? 12 Organization of This Document 12 See Also 13 Chapter 1 OpenGL on the Mac Platform 15 Structure of OpenGL in Mac OS X 16 Programming Interfaces 17 OpenGL APIs Specific to Mac OS X 17 Apple-Implemented OpenGL Libraries 18 Terminology 19 Renderer 19 Renderer and Buffer Attributes 19 Pixel Format Objects 20 Rendering Contexts 20 Drawable Objects 20 Virtual Screens 21 Running an OpenGL Program in Mac OS X 25 See Also 26 Chapter 2 Drawing to a Window or View 29 General Approach 29 Drawing to a Cocoa View 31 Drawing to an NSOpenGLView Class: A Tutorial 31 Drawing OpenGL Content to a Custom View 36 Drawing to a Carbon Window 39 What's Next 41 See Also 41 Chapter 3 Drawing to the Full Screen 43 General Approach 44 Using Cocoa to Create a Full-Screen Context 44 Using AGL to Create a Full-Screen Context 46 Using CGL to Create a Full-Screen Context 48 3 2006-10-03 | © 2004, 2006 Apple Computer, Inc. All Rights Reserved. CONTENTS Adjusting Display Modes 49 What's Next? 50 See Also 50 Chapter 4 Drawing Offscreen 51 Setting Up an Offscreen Drawable Object 51 Using a Hidden View or Window 53 Rendering to a Pixel Buffer 55 Setting Up a Pixel Buffer for Offscreen Drawing 56 Using a Pixel Buffer as a Texture Source 56 Rendering to a Pixel Buffer on a Remote System 58 Rendering to a Framebuffer Object 58 Drawing a Texture Offscreen 59 Drawing a Renderbuffer Image Offscreen 61 See Also 63 Chapter 5 Determining the OpenGL Capabilities Supported by the Hardware 65 Detecting Functionality 65 Guidelines for Code That Checks for Functionality 68 See Also 69 Chapter 6 Techniques for Working with Rendering Contexts 71 Context Parameters 71 Swap Interval 72 Surface Opacity 72 Surface Drawing Order 72 Vertex and Fragment Processing 73 Back Buffer Size Control 73 Updating a Rendering Context 74 Tracking Renderer Changes 75 Updating a Rendering Context for a Custom Cocoa View 75 Updating a Rendering Context for a Carbon Window 77 Updating Full-screen AGL and CGL Rendering Contexts 80 Sharing Rendering Contexts 81 See Also 84 Chapter 7 Techniques for Choosing Attributes 85 Buffer Size Attribute Selection Tips 85 Attributes that are not Recommended 86 Ensuring a Valid Pixel Format Object 86 Ensuring a Specific Type of Renderer 87 Ensuring a Single Renderer for a Display 88 4 2006-10-03 | © 2004, 2006 Apple Computer, Inc. All Rights Reserved. CONTENTS See Also 89 Chapter 8 Techniques for Working with Vertex Data 91 Best Practices for Working with Vertex Data 91 Using Extensions to Improve Performance 93 Vertex Array Range Extension 94 Vertex Buffer Object Extension 96 Fence Extension 98 Double Buffering Vertex Data 99 See Also 100 Chapter 9 Techniques for Working with Texture Data 103 Using Extensions to Optimize 104 Apple Client Storage 105 Apple Texture Range and Rectangle Texture 106 Combining Extensions 107 Optimal Data Formats and Types 109 Working with Non–Power-of-Two Textures 109 Creating Textures from Image Data 111 Creating a Texture from a Cocoa View 111 Creating a Texture from a Quartz Image Source 113 Downloading Texture Data 114 Double Buffering Texture Data 115 See Also 116 Chapter 10 Techniques for Scene Anti-Aliasing 119 Guidelines 119 General Approach 120 Hinting for a Specific Anti-Aliasing Technique 121 Setting Up Full Scene Anti-Aliasing 122 See Also 124 Chapter 11 Multithreading and OpenGL 125 Program Design 125 Guidelines for Threading OpenGL Applications 126 When Things Go Wrong 127 Threading APIs 128 See Also 128 Chapter 12 Improving Performance 129 Best Practices 130 5 2006-10-03 | © 2004, 2006 Apple Computer, Inc. All Rights Reserved. CONTENTS Use Flush and Finish Routines Effectively 130 Be Mindful of OpenGL State Variables 131 Draw Only When Necessary 132 Synchronize with the Screen Refresh Rate 133 Use OpenGL Macros 133 Use the CPU and the GPU Asynchronously 134 Use Appropriate Routines for Images and Pixel Data 135 Retrieve Error Information Only When Debugging 136 Use Optimal Data Types and Formats 136 Gathering and Analyzing Baseline Performance Data 136 Identifying Bottlenecks with Shark 141 See Also 141 Appendix A OpenGL Functionality by Version 143 Version 1.1 143 Version 1.2 144 Version 1.3 145 Version 1.4 145 Version 1.5 146 Version 2.0 146 Appendix B Setting Up Function Pointers to OpenGL Routines 147 Obtaining a Function Pointer to an Arbitrary OpenGL Entry Point 147 Initializing Entry Points 150 Appendix C Quartz Display Services and Full-Screen Mode 153 Displays and Display Modes 153 Fading the Display 155 Controlling the Pointer 158 See Also 158 Glossary 159 Document Revision History 163 6 2006-10-03 | © 2004, 2006 Apple Computer, Inc. All Rights Reserved. Figures, Tables, and Listings Chapter 1 OpenGL on the Mac Platform 15 Figure 1-1 OpenGL provides the reflections in iChat 15 Figure 1-2 Layers of OpenGL for Mac OS X 16 Figure 1-3 The programing interfaces used for OpenGL content 17 Figure 1-4 Data flow through OpenGL 21 Figure 1-5 A virtual screen displays what the user sees 22 Figure 1-6 Two virtual screens 23 Figure 1-7 A virtual screen can represent more than one physical screen 23 Figure 1-8 Two virtual screens and two graphics cards 24 Figure 1-9 The flow of data through OpenGL 25 Chapter 2 Drawing to a Window or View 29 Figure 2-1 OpenGL content in a Cocoa view (left) and a Carbon window (right) 29 Figure 2-2 The Classes pane 32 Figure 2-3 Subclassing NSOpenGLView 32 Figure 2-4 Creating files for MyOpenGLView 33 Figure 2-5 Dragging an NSOpenGLView object to a window 33 Figure 2-6 The Attributes pane in the inspector 34 Figure 2-7 The output from the Golden Triangle program 36 Listing 2-1 The interface for MyOpenGLView 34 Listing 2-2 Include OpenGL/gl.h 35 Listing 2-3 The drawRect: method for MyOpenGLView 35 Listing 2-4 Code that draws a triangle using OpenGL commands 35 Listing 2-5 The interface for a custom OpenGL view 37 Listing 2-6 The initWithFrame:pixelFormat: method 37 Listing 2-7 The lockFocus method 38 Listing 2-8 The drawRect method for a custom view 38 Listing 2-9 Detaching the context from a drawable object 38 Listing 2-10 Setting a Carbon window as a drawable object 40 Chapter 3 Drawing to the Full Screen 43 Figure 3-1 Drawing OpenGL content to the full screen 43 Listing 3-1 Using Cocoa to set up full-screen drawing 45 Listing 3-2 A function that sets up a full-screen context using AGL 46 Listing 3-3 Setting up a full-screen context using CGL 48 7 2006-10-03 | © 2004, 2006 Apple Computer, Inc.
Recommended publications
  • Kinect in Mac: QC and Processing
    Kinect in Mac: Quartz Composer and Processing A brief tutorial by NIRTeam @ TEI Crete Contents ● Using Quartz Composer with Kinect ● Using Processing programming language with kinect ● 3D scanning using Kinect Quartz Composer (QC) ● Node-based visual programming language used mainly for processing and rendering graphics. ● Included in the Xcode developer tools package by Apple ● Quartz Composer uses OpenGL (including GLSL), OpenCL, Core Image, Core Video, JavaScript, and other technologies to build an API and a developer tool Data types inside QC Boolean - a boolean value, 0 or 1 Index - a positive integer between 0 and 2147483647 Number - a double precision floating point number String - a unicode string Color - an RGBA or CMYK quartet, or a Grayscale value Image - a 2D image of arbitrary (possibly infinite) dimensions Structure - a named or ordered collection of objects, including nested structures Virtual - any of the above Mesh - a collection of vertices, and per-vertex normals, texture coordinates, and colors in 3-space. Interaction - a valueless type used to associate user input with user-interactive elements of the composition. QC Programming QC Programming = connecting different nodes (Patches). QC Patches The patches are divided into three categories: 1. “Providers” 2. “Processors” 3. “Consumers” QC resources - http://kineme.net/ - http://quartzcomposer.com/compositions - http://www.quartzcompositions.com/ - http://guides.macrumors.com/Quartz_Composer Kinect & QC Kineme KinectTools plugin http://kineme.net/KinectTools Synapse plugin http://synapsekinect.tumblr.com/ v002 open Kinect example http://kineme.net/forum/Discussion/Programming/v002OpenKinectBeta Quartz-Composer-Open-Kinect-Plugin https://github.com/stoulouse/Quartz-Composer-Open-Kinect-Plugin UIO Kinect with TUIO client QC Plugin https://code.google.com/p/tuiokinect/ http://prdownloads.sourceforge.net/reactivision/TUIO_Quartz-1.4.zip?download Tryplex Toolkit http://code.google.com/p/tryplex/ Kinect & QC: Kineme KinectTools plugin ● Retrieves color and depth image data from the Kinect.
    [Show full text]
  • Advanced Computer Graphics Spring 2011
    CSCI 4830/7000 Advanced Computer Graphics Spring 2011 Instructor ● Willem A (Vlakkies) Schreüder ● Email: [email protected] – Begin subject with 4830 or 7000 – Resend email not answered promptly ● Office Hours: – Before and after Class – By appointment ● Weekday Contact Hours: 6:30am - 9:00pm Course Objectives ● Explore advanced topics in Computer Graphics – Pipeline Programming (Shaders) – Embedded System (OpenGL ES) – GPU Programming (OpenCL) – Ray Tracing – Special topics ● Particle systems ● Assignments: Practical OpenGL – Building useful applications Course Organization and Grading ● Class participation (50% grade) – First hour: Discussion/Show and tell ● Weekly homework assignments ● Volunteers and/or round robin – Second hour: Introduction of next topic ● Semester project (50% grade) – Build a significant application in OpenGL – 15 minute presentation last class periods ● No formal tests or final Assumptions ● You need to be fluent in C – Examples are in C (or simple C++) – You can do assignments in any language ● I may need help getting it to work on my system ● You need to be comfortable with OpenGL – CSCI 4229/5229 or equivalent – You need a working OpenGL environment Grading ● Satisfactory complete all assignments => A – The goal is to impress your friends ● Assignments must be submitted on time unless prior arrangements are made – Due by Thursday morning – Grace period until Thursday noon ● Assignments must be completed individually – Stealing ideas are encouraged – Code reuse with attribution is permitted ● Class attendance HIGHLY encouraged Code Reuse ● Code from the internet or class examples may be used – You take responsibility for any bugs in the code – Make the code your own ● Understand it ● Format it consistently – Improve upon what you found – Credit the source ● The assignment is a minimum requirement Text ● OpenGL Shading Language (3ed) – Randi J.
    [Show full text]
  • Opengl Basics What Is Opengl?
    CS312 OpenGL basics What is openGL? A low-level graphics library specification. A small set of geometric primitives: Points Lines Geometric primitives Polygons Images Image primitives Bitmaps OpenGL Libraries OpenGL core library OpenGL32 on Windows GL/Mesa on most unix/linux systems OpenGL Utility Library (GLU) Provides functionality in OpenGL core but avoids having to rewrite code GL is window system independent Extra libraries are needed to connect GL to the OS GLX – X windows, Unix AGL – Apple Macintosh WGL – Microsoft Windows GLUT OpenGL Utility Toolkit (GLUT) Provides functionality common to all window systems Open a window Get input from mouse and keyboard Menus Event-driven Code is portable but GLUT is minimal Software Organization application program OpenGL Motif widget or similar GLUT GLX, AGL or WGL GLU X, Win32, Mac O/S GL software and/or hardware OpenGL Architecture Immediate Mode Geometric pipeline Per Vertex Polynomial Operations & Evaluator Primitive Assembly Display Per Fragment Frame Rasterization CPU List Operations Buffer Texture Memory Pixel Operations OpenGL State OpenGL is a state machine OpenGL functions are of two types Primitive generating Can cause output if primitive is visible How vertices are processed and appearance of primitive are controlled by the state State changing Transformation functions Attribute functions Typical GL Program Structure Configure and open a window Initialize GL state Register callback functions Render Resize Events Enter infinite event processing loop Render/Display Draw simple geometric primitives Change states (how GL draws these primitives) How they are lit or colored How they are mapped from the user's two- or three-dimensional model space to the two- dimensional screen.
    [Show full text]
  • Mac OS X: an Introduction for Support Providers
    Mac OS X: An Introduction for Support Providers Course Information Purpose of Course Mac OS X is the next-generation Macintosh operating system, utilizing a highly robust UNIX core with a brand new simplified user experience. It is the first successful attempt to provide a fully-functional graphical user experience in such an implementation without requiring the user to know or understand UNIX. This course is designed to provide a theoretical foundation for support providers seeking to provide user support for Mac OS X. It assumes the student has performed this role for Mac OS 9, and seeks to ground the student in Mac OS X using Mac OS 9 terms and concepts. Author: Robert Dorsett, manager, AppleCare Product Training & Readiness. Module Length: 2 hours Audience: Phone support, Apple Solutions Experts, Service Providers. Prerequisites: Experience supporting Mac OS 9 Course map: Operating Systems 101 Mac OS 9 and Cooperative Multitasking Mac OS X: Pre-emptive Multitasking and Protected Memory. Mac OS X: Symmetric Multiprocessing Components of Mac OS X The Layered Approach Darwin Core Services Graphics Services Application Environments Aqua Useful Mac OS X Jargon Bundles Frameworks Umbrella Frameworks Mac OS X Installation Initialization Options Installation Options Version 1.0 Copyright © 2001 by Apple Computer, Inc. All Rights Reserved. 1 Startup Keys Mac OS X Setup Assistant Mac OS 9 and Classic Standard Directory Names Quick Answers: Where do my __________ go? More Directory Names A Word on Paths Security UNIX and security Multiple user implementation Root Old Stuff in New Terms INITs in Mac OS X Fonts FKEYs Printing from Mac OS X Disk First Aid and Drive Setup Startup Items Mac OS 9 Control Panels and Functionality mapped to Mac OS X New Stuff to Check Out Review Questions Review Answers Further Reading Change history: 3/19/01: Removed comment about UFS volumes not being selectable by Startup Disk.
    [Show full text]
  • Mac OS X and PDF: the Real Story
    Mac OS X and PDF The Real Story Leonard Rosenthol Lazerware, Inc. Copyright©1999-2001, Lazerware, Inc. Overview •Mac OS X •PDF • Where’s the overlap? Copyright©1999-2001, Lazerware, Inc. You are here because… • You’re currently working with Mac OS and are interested in what Mac OS X brings to the table. • You’re curious about what Apple’s latest hype is all about. • You’re already awake and had to find something to kill time. • You’re a friend of mine and wanted to heckle Copyright©1999-2001, Lazerware, Inc. How I do things • You should all have copies of the presentation that you received when you walked in. • There is also an electronic copy of this presentation (PDF format, of course!) on my website at http://www.lazerware.com/ • I’ve left time at the end for Q&A, but please feel free to ask questions at any time! Copyright©1999-2001, Lazerware, Inc. Mac OS X Overview Copyright©1999-2001, Lazerware, Inc. Darwin • “Core OS” (Kernel) – Solid Unix foundation • FreeBSD 3.2 & Mach 3.0 • Memory protection, preemptive multitasking, etc. – High performance I/O • Firewire, USB, etc. • Open source Copyright©1999-2001, Lazerware, Inc. Graphics •Quartz – Adobe Imaging Model (PDF) • Includes full anti-aliasing and opacity/transparency • OpenGL – Industry standard 3D engine used by Quake & Maya • QuickTime Copyright©1999-2001, Lazerware, Inc. Graphics Demos - Quartz Copyright©1999-2001, Lazerware, Inc. Graphics Demos – OpenGL Copyright©1999-2001, Lazerware, Inc. Application Frameworks • Classic – Compatibility “box” for existing Mac OS applications. • Carbon – Modern versions of Mac OS applications prepared for Mac OS X.
    [Show full text]
  • IT Acronyms.Docx
    List of computing and IT abbreviations /.—Slashdot 1GL—First-Generation Programming Language 1NF—First Normal Form 10B2—10BASE-2 10B5—10BASE-5 10B-F—10BASE-F 10B-FB—10BASE-FB 10B-FL—10BASE-FL 10B-FP—10BASE-FP 10B-T—10BASE-T 100B-FX—100BASE-FX 100B-T—100BASE-T 100B-TX—100BASE-TX 100BVG—100BASE-VG 286—Intel 80286 processor 2B1Q—2 Binary 1 Quaternary 2GL—Second-Generation Programming Language 2NF—Second Normal Form 3GL—Third-Generation Programming Language 3NF—Third Normal Form 386—Intel 80386 processor 1 486—Intel 80486 processor 4B5BLF—4 Byte 5 Byte Local Fiber 4GL—Fourth-Generation Programming Language 4NF—Fourth Normal Form 5GL—Fifth-Generation Programming Language 5NF—Fifth Normal Form 6NF—Sixth Normal Form 8B10BLF—8 Byte 10 Byte Local Fiber A AAT—Average Access Time AA—Anti-Aliasing AAA—Authentication Authorization, Accounting AABB—Axis Aligned Bounding Box AAC—Advanced Audio Coding AAL—ATM Adaptation Layer AALC—ATM Adaptation Layer Connection AARP—AppleTalk Address Resolution Protocol ABCL—Actor-Based Concurrent Language ABI—Application Binary Interface ABM—Asynchronous Balanced Mode ABR—Area Border Router ABR—Auto Baud-Rate detection ABR—Available Bitrate 2 ABR—Average Bitrate AC—Acoustic Coupler AC—Alternating Current ACD—Automatic Call Distributor ACE—Advanced Computing Environment ACF NCP—Advanced Communications Function—Network Control Program ACID—Atomicity Consistency Isolation Durability ACK—ACKnowledgement ACK—Amsterdam Compiler Kit ACL—Access Control List ACL—Active Current
    [Show full text]
  • Introduction to the Software Libraries Opengl: Open Graphics Library GLU: Opengl Utility Library Glut: Opengl Utility Toolkit
    Introduction to the software libraries This course makes use of several popular libraries to help build sophisticated portable graphics applications with minimal effort. The following diagram gives an overview of the packages and how they interact. For the purposes of this course, one can think of the GLU and glut libraries as being part of the OpenGL library or the OpenGL API (application programmer's interface), eventhough this is not really the case. -provides a software interface to graphics hardware and OpenGL implements most of the graphics functionality. provides support for some additional operations and primitive GLU types, and is implemented using OpenGL function calls designed specifically to be used with OpenGL and it takes care of things like opening windows, redraw events, and keyboard and glut mouse input. It effectively hides all the windowing system dependencies for OpenGL. OpenGL: Open Graphics Library • standardized 3D graphics library (API) • available on many platforms, often with hardware support • derivative of the Silicon Graphics' GL library • all function calls have the gl prefix, e.g.: glScale3fv() • OpenGL resources on the Internet** GLU: OpenGL Utility Library • support for NURBS surfaces, quadric surfaces, surface trimming, ... • all function calls have the glu prefix, e.g.: gluOrtho2D() • comes with all OpenGL implementations, including Windows and Mesa, no separate installation required • typically involves no hardware acceleration • glu32.dll on Win95/Win98/WinNT, look in same directory as Opengl32.dll
    [Show full text]
  • Color Management with Mac OS X Tiger Technology Tour December 2005 Technology Tour 2 Color Management with Mac OS X Tiger
    Color Management with Mac OS X Tiger Technology Tour December 2005 Technology Tour 2 Color Management with Mac OS X Tiger Contents Page 3 Introduction Page 4 The ColorSync Foundation ICC Color Profile Color Management Module Rendering Intent ColorSync Utility Page 12 Color Workflow: Capture Image Capture Images without Profiles Page 15 Color Workflow: Edit Calibrating and Profiling Your Display Communicating Consistent Color Converting to a Preferred Color Space Page 17 Color Workflow: Output Sharing Virtual Color Proofs Checking Color with Print Preview PDF and PostScript Support Using Quartz Filters Workflow Considerations for Output Page 23 Color Workflow: Automation Image Events Automating Color Management Tasks with AppleScript Simplifying Automation Using Automator Page 26 Summary Page 27 Resources Technology Tour 3 Color Management with Mac OS X Tiger Introduction Color has the ability to communicate, to please, to excite, and to engage. Color makes a difference—often a dramatic difference—in your photographs, your graphics, and your layouts. Getting color right early in the workflow, and keeping it right to the end, is increasingly critical in the fast-paced, deadline-driven digital world. Yet photographers and designers are frequently dismayed when they print an image and the color is wildly different from expectations. These disruptive surprises can cost time and money and cause delivery delays and disappointed clients. Color is an elusive phenomenon. Say “red,” and you’re describing a sensation that your eyes and brain associate with a certain wavelength of light. But exactly how “red” is the red? Computers use numbers to more precisely define color; for example, Red 255, Green 0, Blue 0 is a ratio of numbers that describes the maximum “red” in a digital file.
    [Show full text]
  • Opengl API Introduction Agenda
    OpenGL API Introduction Agenda • Structure of Implementation • Paths and Setup • API, Data Types & Function Name Conventions • GLUT • Buffers & Colours 2 OpenGL: An API, Not a Language • OpenGL is not a programming language; it is an application programming interface (API). • An OpenGL application is a program written in some programming language (such as C or C++) that makes calls to one or more of the OpenGL libraries. • Does not mean program uses OpenGL exclusively to do drawing: • It might combine the best features of two different graphics packages. • Or it might use OpenGL for only a few specific tasks and environment- specific graphics (such as the Windows GDI) for others. 3 Implementations • Although OpenGL is a “standard” programming library, this library has many implementations and versions. • On Microsoft Windows the implementation is in the opengl32.dll dynamic link library, located in the Windows system directory. • The OpenGL library is usually accompanied by the OpenGL utility library (GLU), which on Windows is in glu32.dll,. • GLU is a set of utility functions that perform common tasks, such as special matrix calculations, or provide support for common types of curves and surfaces. • On Mac OS X, OpenGL and the GLU libraries are both included in the OpenGL Framework. • The steps for setting up your compiler tools to use the correct OpenGL headers and to link to the correct OpenGL libraries vary from tool to tool and from platform to platform. 4 Include Paths • On all platforms, the prototypes for all OpenGL functions, types, and macros #include<windows.h> are contained (by convention) in the #include<gl/gl.h> header file gl.h.
    [Show full text]
  • Exercise 3 Identification of Rocks and Soil Materials
    EXERCISE 3 IDENTIFICATION OF ROCKS AND SOIL MATERIALS INTRODUCTION This is the second lab designed to familiarize you with common materials naturally occurring in the Earth. The elements present in the Earth are organized into mineral grains, which are themselves aggregated into rocks. An ability to recognize minerals and rocks is basic to many activities in exploration, development and engineering, and we will ask you to utilize the skills you develop in this lab for subsequent lab exercises in this course. To prepare for this lab you should have read the appropriate sections on rocks and minerals in your text. Be sure to bring your textbook with you to lab for reference. In lab you will learn to identify common rock- forming minerals by their physical properties, and then you will learn to recognize common rocks. BACKGROUND INFORMATION ROCK IDENTIFICATION BY MINERAL COMPOSITION AND TEXTURE Rocks are mixtures of minerals, held together by relatively weak bonds between individual mineral grains or in some cases by cementing materials, which act like glue. Rocks can be classified based on their chemical compositions (observed as the types and proportions of minerals present), or based upon the processes by which they formed (observed as the size, shape and orientation of the mineral grains, or texture of the rock). Classification Classification of rocks is based on origin: Igneous rocks are formed by solidification of magma/lava (freezing) or by accumulation of fragments ejected during volcanic eruptions. Sedimentary rocks are formed by the deposition and subsequent aggregation of rock or mineral fragments produced by erosion and transported by gravity, wind, ice or water.
    [Show full text]
  • NVIDIA's Opengl Functionality
    NVIDIANVIDIA ’’ss OpenGLOpenGL FunctionalityFunctionality Session 2127 | Room A5 | Monday, September, 20th, 16:00 - 17:20 San Jose Convention Center, San Jose, California Mark J. Kilgard • Principal System Software Engineer – OpenGL driver – Cg (“C for graphics”) shading language • OpenGL Utility Toolkit (GLUT) implementer • Author of OpenGL for the X Window System • Co-author of Cg Tutorial Outline • OpenGL’s importance to NVIDIA • OpenGL 3.3 and 4.0 • OpenGL 4.1 • Loose ends: deprecation, Cg, further extensions OpenGL Leverage Cg Parallel Nsight SceniX CompleX OptiX Example of Hybrid Rendering with OptiX OpenGL (Rasterization) OptiX (Ray tracing) Parallel Nsight Provides OpenGL Profiling Configure Application Trace Settings Parallel Nsight Provides OpenGL Profiling Magnified trace options shows specific OpenGL (and Cg) tracing options Parallel Nsight Provides OpenGL Profiling Parallel Nsight Provides OpenGL Profiling Trace of mix of OpenGL and CUDA shows glFinish & OpenGL draw calls OpenGL In Every NVIDIA Business OpenGL on Quadro – World class OpenGL 4 drivers – 18 years of uninterrupted API compatibility – Workstation application certifications – Workstation application profiles – Display list optimizations – Fast antialiased lines – Largest memory configurations: 6 gigabytes – GPU affinity – Enhanced interop with CUDA and multi-GPU OpenGL – Advanced multi-GPU rendering – Overlays – Genlock – Unified Back Buffer for less framebuffer memory usage – Cross-platform • Windows XP, Vista, Win7, Linux, Mac, FreeBSD, Solaris – SLI Mosaic –
    [Show full text]
  • Core Graphics and Opengl ES Dr
    Core Graphics and OpenGL ES Dr. Sarah Abraham University of Texas at Austin CS329e Spring 2020 Core Graphics ✤ Apple’s vector-drawing framework ✤ Previously known as Quartz or Quartz2D ✤ Includes handling for: ✤ Geometric data such as points, vectors, shapes etc ✤ Functions for rendering pixels to screen Vector Drawings ✤ Vectors defined mathematically (rather than by pixel) ✤ Allows for continuous scaling and additional manipulation ✤ More robust than bitmap (raster) graphics ✤ Built from geometric primitives like points, lines, curves, and shapes ✤ Points define lines and curves, lines and curves define shapes etc Vector Example Vectorization vs Rasterization ✤ Vector Advantages: ✤ Infinite scaling (not resolution dependent) ✤ Smaller file size ✤ Used most frequently for line-art with flat, uniform coloring ✤ Logos, letterhead, fonts etc ✤ Bitmap Advantages: ✤ Capture gradations and complex composition ✤ A lot of detail at high resolution ✤ Used most frequently for graphics used “at-resolution” ✤ Photographs, scanned artwork, pixel-based art etc Using Computer Graphics ✤ Graphics libraries require a graphics context ✤ Graphics context describes the “state” of world in which you are drawing 1. User tells graphics context how and where to draw 2. User specifies what to draw 3. Graphic context draws according to specification What does the Graphics Context need to know? ✤ Graphic context identifies draw destination, coordinate system ✤ Destination can be screen, printer, PDF file, etc ✤ Graphics context maintains global information about current
    [Show full text]