OpenGL Programming on Mac OS X: Architecture, Performance, and Integration [NOOK Book]

Overview

The Mac has fully embraced OpenGL throughout its visual systems. In fact, Apple's highly efficient, modern OpenGL implementation makes Mac OS X one of today's best platforms for OpenGL development. OpenGL® Programming on Mac OS® X is the first comprehensive resource for every graphics programmer who wants to create, port, or optimize OpenGL applications for this high-volume platform.

Leading OpenGL experts Robert Kuehne and J. D. Sullivan thoroughly explain the Mac's diverse ...

See more details below
OpenGL Programming on Mac OS X: Architecture, Performance, and Integration

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac

Want a NOOK? Explore Now

NOOK Book (eBook)
$37.99
BN.com price
(Save 13%)$43.99 List Price

Overview

The Mac has fully embraced OpenGL throughout its visual systems. In fact, Apple's highly efficient, modern OpenGL implementation makes Mac OS X one of today's best platforms for OpenGL development. OpenGL® Programming on Mac OS® X is the first comprehensive resource for every graphics programmer who wants to create, port, or optimize OpenGL applications for this high-volume platform.

Leading OpenGL experts Robert Kuehne and J. D. Sullivan thoroughly explain the Mac's diverse OpenGL APIs, both old and new. They illuminate crucial OpenGL setup, configuration, and performance issues that are unique to the Mac platform. Next, they offer practical, start-to-finish guidance for integrating key Mac-native APIs with OpenGL, and leveraging the full power of the Mac platform in your graphics applications.

Coverage includes

  • A thorough review of Mac hardware and software architectures and their performance implications
  • In-depth, expert guidance for accessing OpenGL from each of the Mac's core APIs: CGL, AGL, and Cocoa
  • Interoperating with other Mac APIs: incorporating video with QuickTime, performing image effects with Core Image, and processing CoreVideo data
  • Analyzing Mac OpenGL application performance, resolving bottlenecks, and leveraging optimizations only available on the Mac
  • Detecting, integrating, and using OpenGL extensions
  • An accompanying Web site (www.macopenglbook.com) contains the book's example code, plus additional OpenGL-related resources.

OpenGL® Programming on Mac OS® X will be valuable to Mac programmers seeking to leverage OpenGL's power, OpenGL developers porting their applications to the Mac platform, and cross-platform graphics developers who want to take advantage of the Mac platform's uniquely intuitive style and efficiency.

Read More Show Less

Editorial Reviews

From Barnes & Noble
In recent years, the Mac has become a state-of-the-art platform for OpenGL graphics programming. Now, there's a book that shows how to take full advantage of OpenGL on Mac OS X, whether you're creating new applications from scratch, porting from other platforms, or optimizing existing OpenGL code.

While OpenGL is, of course, a cross-platform standard, there are plenty of issues (and opportunities) unique to OpenGL for the Mac. These range from setup and configuration to the Mac's unique hardware and OS X's unique performance optimizations. And, of course, integration with the Mac's own APIs. All that's covered here. There's especially comprehensive coverage of API integration: with CGL, AGL, Cocoa, QuickTime, Core Image, and CoreVideo. (And, yes, there's plenty of code, all downloadable.)

Until now, it's been difficult to find coherent, complete information about Mac OpenGL programming. Anyone who's tried will realize just how welcome this book is. Bill Camarda, from the December 2007 Read Only

Read More Show Less

Product Details

  • ISBN-13: 9780132701808
  • Publisher: Pearson Education
  • Publication date: 12/31/2007
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 1
  • Pages: 384
  • File size: 6 MB

Meet the Author

Robert P. Kuehne leads Blue Newt Software, a consultancy that specializes in helping clients enhance their 3D graphics applications. Formerly Technical Lead for Silicon Graphics' OpenGL Shading Language, Kuehne has been involved with OpenGL since it was created, in roles ranging from programmer to shader compiler developer to SIGGRAPH presenter. He has also been a Macintosh developer since the early 1990s.

J. D. Sullivan is an OpenGL driver engineer who has been writing graphics software professionally for more than fifteen years. While at Silicon Graphics, Inc., he was one of the original designers and implementers of the Volumizer API and later worked as part of the OpenGL software team focused on the Cobalt and Krypton graphics chipsets. Since SGI, Sullivan has worked on the Mac as his primary development platform, and he serves on the OpenGL Architecture Review Board.

Read More Show Less

Read an Excerpt

The Mac is a computing platform that virtually defines ease of use, consistency, and effortless computing. The story of OpenGL on the Mac has been, shall we say, a bit more complex. With the arrival of OS X, the Mac platform supports even more ways of constructing OpenGL applications for the Mac. While there has been an apparent proliferation of OpenGL interfaces for the Mac, the platform itself has stabilized architecturally and programmatically and now offers the best developer and user experience in the industry for development of graphics applications. This is not just a statement of preference but an observation that, in many ways, the Mac is an OpenGL platform without peer. The Mac is a fun and efficient platform on which to develop applications, thanks to the set of OpenGL drivers at its core that support a rich and deep feature set, great performance, and deep integration in OS X. The Mac has excellent and usable tools for quickly monitoring OpenGL behavior, rapidly prototyping shaders, and digging deep to analyze OpenGL behavior in the application and driver. The Mac makes OpenGL development efficient and fun.

Although the development tools and environment are powerful and helpful, many corners of OpenGL on the Mac remain under-documented. A developer must choose among several development languages, user interface (UI) toolkits, window managers, and additional Mac APIs such as QuickTime and Core Image, yet still ensure that his or her software runs well on a variety of target Mac platforms. All of these factors can make using OpenGL on the Mac a challenging task even for developers who have been writing OpenGL applications on other platforms for years.

This book was puttogether with an eye toward simplifying and clarifying the ways in which OpenGL can be used on the Mac. It is our hope that by codifying all the information available about OpenGL on the Mac in one place and by presenting each interface with clarity and depth, developers will have a one stop reference for all things OpenGL on the Mac.Who Should Read This Book?

This book is intended for OpenGL programmers who wish to develop applications on Mac OS X. We target two categories of OpenGL programmers: those who are new to OpenGL on the Mac and those who want to explore the specific benefits of writing OpenGL programs on the Mac.

For those who are new to OpenGL on the Mac—either existing Mac developers or those coming from other platforms—we provide advice on cross-platform issues, portable interfaces, and ideas about choosing native interfaces for the Mac. Existing Mac developers will find a single-source reference guide to all OpenGL interfaces on the Mac. For developers wishing to explore the power and richness of the Mac, we provide complete details on Mac-specific OpenGL extensions and ways of integrating other Mac APIs (such as QuickTime and Core Image) into applications.Organization

This text is intended to be useful as both a programming guide and a reference manual. The text contains several chapters focused on OpenGL on the Mac and other chapters that cover related graphics information. A few appendices are included to cover supplemental information in detail. The chapters are organized as follows:

  • Architecture Chapters 1 through 4 describe the hardware and software architectures of the Mac. This part of the book also presents an introduction to performance considerations as they relate to architecture.
  • Configuration and Integration Chapter 5 explores the interfaces to OpenGL on the Mac in detail. Those new to OpenGL on the Mac should begin here.
  • CGL, AGL, Cocoa, GLUT Chapters 6 through 9 explore details behind the individual APIs. Each API is covered in detail in its own chapter, and the APIs are compared and contrasted in each chapter. These chapters form the core of this book.
  • Interoperability Chapter 10 collects a variety of interesting OpenGL and other Mac API integration ideas. This chapter describes how to incorporate video in an application with QuickTime, perform image effects on textures or scenes with Core Image, and process CoreVideo data in an application.
  • Performance Chapters 11 and 12 describe the basics of analyzing performance of OpenGL applications and offer tips about where common problems may surface and how they might be resolved. Analysis, tools, architecture, data types, and solutions are covered.
  • Extensions Chapter 13 presents a guide to detecting, integrating, and using OpenGL extensions. This chapter introduces extension management principles and tools and provides details on how to perform such management specifically on the Mac.
Additional Resources

As both OpenGL and the Mac platform evolve, so must developers' applications. At our website, www.macopenglbook.com, we provide our example OpenGL code as well as other OpenGL-related resources. Additionally, we track and provide corrections for any errata and typos. Although we aspire to Knuthlike greatness, we are open to the idea that bugs may yet lurk within these pages. Should you find a possible gaffe, please bring it to our attention through our website.

This book has been a project long in the making, and rumblings of Leopard, Mac OS X 10.5, have been part of our plan since the beginning. However, due to information embargoes, the paucity of information available to the public, and publishing timelines, our best efforts at incorporating final, released Leopard specific details are thwarted. Although we've accounted for most major changes to OpenGL programming for Leopard in this book, there was still some degree of flux for Leopard features at the time this book was published. Never fear, we've put together a detailed Leopard change synopsis for OpenGL, and accounted for the flux in Leopard on our website in an extra chapter. You'll find this bonus chapter at our website: www.macopenglbook.com.

A few words on Leopard that we can say at this time with authority: First, Leopard will provide OpenGL 2.0 and OpenGL ES support. OpenGL 2.0 is a great baseline for OpenGL developers, providing the most modern of OpenGL foundations upon which to develop. Also of interest is the inclusion of OpenGL ES in this release. ES stands for embedded system, and is a nice, stripped-down version of OpenGL, largely targeting handheld devices. At this time, if writing an application for a desktop system, it would still be most sensible to target OpenGL 2.0. However, if you're building and testing a cross-platform device that might be used for handheld devices, OpenGL ES would be a good OpenGL SDK to develop against. Second, Apple's tools for development and debugging are a lot more comprehensive in Leopard. XRay, in particular, integrates a variety of debugging tools in one information view, making it much easier to target certain types of bottlenecks, specifically those involving data transfer. Finally, Leopard brings a lot of bug-fixes and feature enhancements.We've got informationon bits and pieces of the Leopard OpenGL throughout the book. But you'll have to read about the final and released version in our Leopard chapter on the website.

So, once you have this book in your hands, please go to the website and get the addendum. We think you'll be pleased with the detail and additional information it offers on the released version of Leopard. We consider it the definitive source of independent information for OpenGL on Leopard, Mac OSX 10.5. Get it by going to: www.macopenglbook.com.

Read More Show Less

Table of Contents

List of Figures    xv
List of Tables    xix
List of Examples    xxi
Preface    xxv
Acknowledgments    xxix
About the Authors    xxxi
Chapter 1: Mac OpenGL Introduction    1
Why the Mac? 2
Why OpenGL? 3
The Book 4
Chapter 2: OpenGL Architecture on OS X    7
Overview 7
About OpenGL 7
OpenGL Feature Support 14
API Layers 15
The Mac OS OpenGL Plug-In Architecture 17
Renderers 18
Summary 21
Chapter 3: Mac Hardware Architecture    23
Overview 23
Data Flow and Limitations 24
Summary 32
Chapter 4: Application Programming on OS X    33
Overview 33
Mac OS X Versions 33
System Configuration 34
Power Management 34
Filesystem 38
Finding, Verifying, and Filing Bugs 39
Threading 41
Data Parallel Computation: SIMD 42
Chapter 5: OpenGL Configuration and Integration    45
API Introductions and Overview 46
Configuration API Relationships 49
Chapter 6: The CGL API for OpenGL Configuration    55
Overview 55
Error Handling 57
Pixel Format Selection 57
Context Management 63
Drawables 77
Using CGL Macros 86
Summary 86
Chapter 7: The AGL API for OpenGL Configuration    89
Overview 89
Software Layering 90
Pixel Format and Context 91
Additional Topics 104
Alternative Rendering Destinations 109
Summary 120
Chapter 8: The Cocoa API for OpenGL Configuration    121
Overview 122
NSOpenGLView 122
NSView 133
Additional Topics 140
Alternative Rendering Destinations 152
Summary 162
Chapter 9: The GLUT API for OpenGL Configuration    163
Overview 164
Configuration and Setup 165
Summary 171
Chapter 10: API Interoperability    173
Overview 173
Cocoa Image: NSImage 174
QuickTime 184
Summary 193
Chapter 11: Performance    195
Overview 195
Axioms for Designing High-Performance OpenGL Applications 196
OpenGL for Mac OS X Rules of Thumb for Performance 201
Metrics 207
Efficient Data Management Using Mac OpenGL 209
Efficient Handling of Vertex Data 210
Efficient Handling of Texture Data 221
Textures 225
Shaders 226
Tools 226
Graphics Tools 228
Putting It All Together 237
Summary 243
Chapter 12: Mac Platform Compatibility    245
Mac OS Versions 245
OpenGL Platform Identification 248
Mac OS Version Identification 249
Summary 251
Chapter 13: OpenGL Extensions    253
Overview 253
Extension Design and API Integration 254
Extension Styles and Types 256
Identification, Selection, Query, and Usage 257
Utilization and Binding 262
Extension Management Libraries 269
Summary 275
Appendix A: X11 APIs for OpenGL Configuration    277
Installation 277
Building X11 Applications on OS X 278
X11 Color Models 279
Appendix B: Glossary    281 Appendix C: The Cocoa API for OpenGL Configuration in Leopard, Mac OS X 10.5    283
Overview 284
NSOpenGLView 284
NSView 294
Additional Topics 300
Alternative Rendering Destinations 312
Summary 322
Appendix D: Bibliography    323 Index    325
Read More Show Less

Preface

The Mac is a computing platform that virtually defines ease of use, consistency, and effortless computing. The story of OpenGL on the Mac has been, shall we say, a bit more complex. With the arrival of OS X, the Mac platform supports even more ways of constructing OpenGL applications for the Mac. While there has been an apparent proliferation of OpenGL interfaces for the Mac, the platform itself has stabilized architecturally and programmatically and now offers the best developer and user experience in the industry for development of graphics applications. This is not just a statement of preference but an observation that, in many ways, the Mac is an OpenGL platform without peer. The Mac is a fun and efficient platform on which to develop applications, thanks to the set of OpenGL drivers at its core that support a rich and deep feature set, great performance, and deep integration in OS X. The Mac has excellent and usable tools for quickly monitoring OpenGL behavior, rapidly prototyping shaders, and digging deep to analyze OpenGL behavior in the application and driver. The Mac makes OpenGL development efficient and fun.

Although the development tools and environment are powerful and helpful, many corners of OpenGL on the Mac remain under-documented. A developer must choose among several development languages, user interface (UI) toolkits, window managers, and additional Mac APIs such as QuickTime and Core Image, yet still ensure that his or her software runs well on a variety of target Mac platforms. All of these factors can make using OpenGL on the Mac a challenging task even for developers who have been writing OpenGL applications on other platforms for years.

This book was put together with an eye toward simplifying and clarifying the ways in which OpenGL can be used on the Mac. It is our hope that by codifying all the information available about OpenGL on the Mac in one place and by presenting each interface with clarity and depth, developers will have a one stop reference for all things OpenGL on the Mac.

Who Should Read This Book?

This book is intended for OpenGL programmers who wish to develop applications on Mac OS X. We target two categories of OpenGL programmers: those who are new to OpenGL on the Mac and those who want to explore the specific benefits of writing OpenGL programs on the Mac.

For those who are new to OpenGL on the Mac--either existing Mac developers or those coming from other platforms--we provide advice on cross-platform issues, portable interfaces, and ideas about choosing native interfaces for the Mac. Existing Mac developers will find a single-source reference guide to all OpenGL interfaces on the Mac. For developers wishing to explore the power and richness of the Mac, we provide complete details on Mac-specific OpenGL extensions and ways of integrating other Mac APIs (such as QuickTime and Core Image) into applications.

Organization

This text is intended to be useful as both a programming guide and a reference manual. The text contains several chapters focused on OpenGL on the Mac and other chapters that cover related graphics information. A few appendices are included to cover supplemental information in detail. The chapters are organized as follows:

  • Architecture Chapters 1 through 4 describe the hardware and software architectures of the Mac. This part of the book also presents an introduction to performance considerations as they relate to architecture.
  • Configuration and Integration Chapter 5 explores the interfaces to OpenGL on the Mac in detail. Those new to OpenGL on the Mac should begin here.
  • CGL, AGL, Cocoa, GLUT Chapters 6 through 9 explore details behind the individual APIs. Each API is covered in detail in its own chapter, and the APIs are compared and contrasted in each chapter. These chapters form the core of this book.
  • Interoperability Chapter 10 collects a variety of interesting OpenGL and other Mac API integration ideas. This chapter describes how to incorporate video in an application with QuickTime, perform image effects on textures or scenes with Core Image, and process CoreVideo data in an application.
  • Performance Chapters 11 and 12 describe the basics of analyzing performance of OpenGL applications and offer tips about where common problems may surface and how they might be resolved. Analysis, tools, architecture, data types, and solutions are covered.
  • Extensions Chapter 13 presents a guide to detecting, integrating, and using OpenGL extensions. This chapter introduces extension management principles and tools and provides details on how to perform such management specifically on the Mac.

Additional Resources

As both OpenGL and the Mac platform evolve, so must developers' applications. At our website, www.macopenglbook.com, we provide our example OpenGL code as well as other OpenGL-related resources. Additionally, we track and provide corrections for any errata and typos. Although we aspire to Knuthlike greatness, we are open to the idea that bugs may yet lurk within these pages. Should you find a possible gaffe, please bring it to our attention through our website.

This book has been a project long in the making, and rumblings of Leopard, Mac OS X 10.5, have been part of our plan since the beginning. However, due to information embargoes, the paucity of information available to the public, and publishing timelines, our best efforts at incorporating final, released Leopard specific details are thwarted. Although we've accounted for most major changes to OpenGL programming for Leopard in this book, there was still some degree of flux for Leopard features at the time this book was published. Never fear, we've put together a detailed Leopard change synopsis for OpenGL, and accounted for the flux in Leopard on our website in an extra chapter. You'll find this bonus chapter at our website: www.macopenglbook.com.

A few words on Leopard that we can say at this time with authority: First, Leopard will provide OpenGL 2.0 and OpenGL ES support. OpenGL 2.0 is a great baseline for OpenGL developers, providing the most modern of OpenGL foundations upon which to develop. Also of interest is the inclusion of OpenGL ES in this release. ES stands for embedded system, and is a nice, stripped-down version of OpenGL, largely targeting handheld devices. At this time, if writing an application for a desktop system, it would still be most sensible to target OpenGL 2.0. However, if you're building and testing a cross-platform device that might be used for handheld devices, OpenGL ES would be a good OpenGL SDK to develop against. Second, Apple's tools for development and debugging are a lot more comprehensive in Leopard. XRay, in particular, integrates a variety of debugging tools in one information view, making it much easier to target certain types of bottlenecks, specifically those involving data transfer. Finally, Leopard brings a lot of bug-fixes and feature enhancements.We've got informationon bits and pieces of the Leopard OpenGL throughout the book. But you'll have to read about the final and released version in our Leopard chapter on the website.

So, once you have this book in your hands, please go to the website and get the addendum. We think you'll be pleased with the detail and additional information it offers on the released version of Leopard. We consider it the definitive source of independent information for OpenGL on Leopard, Mac OSX 10.5. Get it by going to: www.macopenglbook.com.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted February 25, 2008

    A reviewer

    The text describe the nitty gritty of coding or porting your OpenGL applications to the Mac OS X environment. To a limited extent, the book has a general treatment of programming in OpenGL. But it is not meant as a text on the latter. Instead the focus is on the 'issues' that making for possible problems on OS X. One of which is that OS X has 2 types of windows, Carbon and Cocoa. It sure would be nicer if there was only one. But this is what you have to deal with. The Apple OpenGL (AGL) is the interface to Carbon, while you need the Cocoa OpenGL for Cocoa. It is slightly unusual that a major platform would have 2 types, and you may want to code just for one type. The book gives many details about both APIs, as well as the GLUT API. An evenhanded discussion. Different readers might well have different preferences. Some of you should check out the discussion about multithreading, if intensive graphics performance is needed in your applications. The OS X OpenGL engine is said to have much better performance due to its multithreading, than typical serial engines.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)