وبلاگ بلیان

راهنمای برنامه‌نویسی OpenGL: راهنمای رسمی یادگیری OpenGL، نسخه ۲ (ویرایش پنجم)

OpenGL(R) Programming Guide: The Official Guide to Learning OpenGL(R), Version 2 (5th Edition) (OpenGL)

معرفی کتاب «راهنمای برنامه‌نویسی OpenGL: راهنمای رسمی یادگیری OpenGL، نسخه ۲ (ویرایش پنجم)» (با عنوان لاتین OpenGL(R) Programming Guide: The Official Guide to Learning OpenGL(R), Version 2 (5th Edition) (OpenGL)) نوشتهٔ OpenGL Architecture Review Board, Dave Shreiner, Mason Woo, Jackie Neider, Tom Davis، منتشرشده توسط نشر Addison-Wesley Professional در سال 2005. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.

راهنمای برنامه‌نویسی OpenGL که در میان برنامه‌نویسان گرافیک به «کتاب سرخ» (Red Book) شهرت دارد، به عنوان مرجعی قطعی و جامع برای یادگیری این رابط برنامه‌نویسی قدرتمند شناخته می‌شود. ویرایش پنجم این کتاب که توسط هیئت بازبینی معماری OpenGL و گروهی از متخصصان برجسته این حوزه تدوین شده، مسیری گام‌به‌گام برای تسلط بر قابلیت‌های نسخه‌های.۵ و.۰ OpenGL ارائه می‌دهد. این اثر با پوشش دادن مباحث از مفاهیم پایه‌ای تا تکنیک‌های پیشرفته، همچنان به عنوان یکی از معتبرترین و پرفروش‌ترین منابع آموزش این کتابخانه گرافیکی باقی مانده است.

دربارهٔ کتاب راهنمای برنامه‌نویسی OpenGL: راهنمای رسمی یادگیری OpenGL، نسخه ۲ (ویرایش پنجم)

این کتاب که در سال ۲۰۰۵ منتشر شده، نقطه عطفی در تاریخ آموزش OpenGL محسوب می‌شود، چراکه برای نخستین بار به معرفی زبان سایه‌زن OpenGL (GLSL) و تغییرات بنیادین نسخه.۰ می‌پردازد. نویسندگان با زبانی روان و ساختاری منطقی، خواننده را از مفاهیم ابتدایی مانند ایجاد و نمایش مدل‌های سه‌بعدی، تنظیم دیدگاه و اعمال جلوه‌های نوری و بافت، تا مباحث پیشرفته‌ای چون نگاشت بافت، ضدپوشش (Antialiasing)، جلوه‌های جوی، منحنی‌های NURBS و پردازش تصویر راهنمایی می‌کنند. این ویرایش با هدف به‌روزرسانی محتوای نسخه قبلی و پوشش قابلیت‌های جدیدی همچون ذخیره‌سازی آرایه‌های رأس در بافرهای شیءگرا برای افزایش سرعت رندرینگ، پرس‌وجوهای پنهان‌سازی و پشتیبانی از بافت‌هایی با ابعاد غیرقدرت دو، نگارش یافته است. این کتاب که به عنوان راهنمای رسمی یادگیری OpenGL شناخته می‌شود، به دلیل پوشش جامع و دقیق خود، همواره منبعی معتبر برای برنامه‌نویسان بوده است. بازبین‌کننده‌ای در وب‌سایت اسلشدات، این کتاب را «بسیار کامل و دقیق» توصیف کرده و به پوشش تقریباً تمام ویژگی‌های OpenGL، حتی موارد کمتر استفاده‌شده، اشاره کرده است. این جامعیت به همراه مثال‌های کاربردی و تصاویر متعدد که برخی از آن‌ها به صورت رنگی در میانه کتاب ارائه شده‌اند، آن را به منبعی ارزشمند برای درک عمیق این کتابخانه تبدیل کرده است.

دربارهٔ نویسنده

نویسندگان این کتاب، دیو شراینر (Dave Shreiner)، میسون وو (Mason Woo)، جکی نیدر (Jackie Neider) و تام دیویس (Tom Davis) همگی از چهره‌های شاخص و تأثیرگذار در جامعه برنامه‌نویسی گرافیک هستند. دیو شراینر که نام او به عنوان یکی از نویسندگان اصلی برجسته است، مشاور برجسته OpenGL و عضو دیرینه تیم هسته این فناوری در شرکت سیلیکون گرافیکس (SGI) بوده است. او نخستین دوره آموزشی تجاری OpenGL را تدوین کرده و بیش از دو دهه تجربه در توسعه نرم‌افزارهای گرافیک رایانه‌ای دارد. این کتاب با نظارت هیئت بازبینی معماری OpenGL (OpenGL Architecture Review Board) که کنسرسیومی متشکل از شرکت‌های پیشرو در این صنعت است، تدوین شده و به همین دلیل از اعتبار و دقت بالایی برخوردار است.

چرا باید راهنمای برنامه‌نویسی OpenGL: راهنمای رسمی یادگیری OpenGL، نسخه ۲ (ویرایش پنجم) را بخوانید؟

مرجع کامل و معتبر یادگیری OpenGL: این کتاب که با نام «کتاب سرخ» شناخته می‌شود، به عنوان استاندارد طلایی آموزش این کتابخانه گرافیکی، تمامی جنبه‌های آن را از مفاهیم پایه تا پیشرفته پوشش می‌دهد. آشنایی با تحولات نسخه.۰ و زبان سایه‌زن GLSL: این ویرایش به طور ویژه به معرفی زبان برنامه‌نویسی سایه‌زن OpenGL پرداخته و نحوه استفاده از آن را برای خلق جلوه‌های گرافیکی پیچیده و افزایش توان محاسباتی آموزش می‌دهد. پوشش جامع تکنیک‌های پایه و پیشرفته گرافیک: از ساخت مدل‌های سه‌بعدی و نمایش آن‌ها تا مباحثی چون نگاشت بافت، جلوه‌های نوری، ضدپوشش و پردازش تصویر، همگی با بیانی روشن و مثال‌های عملی تشریح شده‌اند. به‌روزرسانی با جدیدترین قابلیت‌ها: این ویرایش شامل ویژگی‌های جدیدی از جمله ذخیره‌سازی آرایه‌ها در بافرهای شیءگرا، پرس‌وجوهای پنهان‌سازی برای تست دید درشت‌دانه، بافت‌هایی با ابعاد غیرقدرت دو، و عملیات مجزای استنسیل برای کانال‌های رنگی است. ارائه نکات کاربردی و تکنیک‌های بهینه‌سازی: کتاب به تکنیک‌های افزایش کارایی، استفاده از افزونه‌های OpenGL و روش‌های قابل حمل در پلت‌فرم‌های مختلف پرداخته و برای برنامه‌نویسان حرفه‌ای نیز حاوی نکات ارزشمندی است.

این کتاب برای چه کسانی مناسب است؟

این کتاب برای طیف گسترده‌ای از برنامه‌نویسان و دانشجویان حوزه گرافیک رایانه‌ای طراحی شده است. مخاطبان اصلی آن، برنامه‌نویسانی هستند که پیش‌زمینه‌ای در زبان برنامه‌نویسی C و دانش پایه‌ای از ریاضیات (هندسه، جبر خطی و مثلثات) دارند و می‌خواهند یادگیری OpenGL را از سطح مقدماتی آغاز کنند. این اثر هم برای مبتدیانی که هیچ آشنایی قبلی با OpenGL ندارند و هم برای برنامه‌نویسانی که با نسخه‌های قدیمی‌تر کار کرده‌اند و می‌خواهند دانش خود را به نسخه.۰ به‌روز کنند، بسیار مناسب است. توسعه‌دهندگان بازی‌های رایانه‌ای، نرم‌افزارهای شبیه‌سازی، سیستم‌های واقعیت مجازی و هر برنامه‌ای که نیازمند تولید تصاویر با کیفیت بالا باشد، از مطالعه این کتاب سود خواهند برد.

سوالات متداول

آیا برای شروع خواندن این کتاب به پیش‌زمینه گرافیک رایانه‌ای نیاز است؟

این کتاب با فرض دانش پایه‌ای از ریاضیات (مانند هندسه و جبر خطی) و آشنایی با زبان برنامه‌نویسی C نوشته شده است. اگرچه داشتن تجربه قبلی در گرافیک رایانه‌ای مفید است، اما نویسندگان مباحث را از سطح ابتدایی آغاز کرده و مفاهیم پایه‌ای را به خوبی توضیح می‌دهند تا خوانندگان با هر سطح از دانش بتوانند از آن بهره ببرند.

تفاوت اصلی این ویرایش پنجم با ویرایش چهارم در چیست؟

تفاوت عمده در پوشش قابلیت‌های جدید نسخه‌های.۵ و.۰ OpenGL است. مهم‌ترین تغییر، معرفی و تشریح زبان سایه‌زن OpenGL (GLSL) است که امکان برنامه‌ریزی مستقیم روی واحد پردازش گرافیکی (GPU) را فراهم می‌کند. همچنین قابلیت‌های دیگری مانند بافت‌های با ابعاد غیرقدرت دو و عملیات پیشرفته‌تر روی بافرها به آن اضافه شده است.

آیا این کتاب تنها به مفاهیم تئوری می‌پردازد یا مثال‌های عملی نیز دارد؟

این کتاب با ارائه مثال‌های کاربردی و کدهای نوشته شده به زبان C، مفاهیم را به صورت عملی نیز آموزش می‌دهد. هدف اصلی کتاب، توانمندسازی خواننده برای نوشتن برنامه‌های واقعی و تعاملی با OpenGL است و در سراسر متن، مثال‌هایی برای درک بهتر مباحث ارائه شده است.

OpenGL is a powerful software interface used to produce high-quality, computer-generated images and interactive applications using 2D and 3D objects, bitmaps, and color images. The OpenGLA (R) Programming Guide, Fifth Edition, provides definitive and comprehensive information on OpenGL and the OpenGL Utility Library. The previous edition covered OpenGL through Version 1.4. This fifth edition of the best-selling "red book" describes the latest features of OpenGL Versions 1.5 and 2.0, including the introduction of the OpenGL Shading Language. You will find clear explanations of OpenGL functionality and many basic computer graphics techniques, such as building and rendering 3D models; interactively viewing objects from different perspective points; and using shading, lighting, and texturing effects for greater realism. In addition, this book provides in-depth coverage of advanced techniques, including texture mapping, antialiasing, fog and atmospheric effects, NURBS, image processing, and more. The text also explores other key topics such as enhancing performance, OpenGL extensions, and cross-platform techniques.This fifth edition has been extensively updated to include the newest features of OpenGL Versions 1. 5 and 2.0, including: \*Storage of vertex arrays in buffer objects for faster rendering \*Occlusion queries for course-grain visibility testing \*Non-power-of-two dimensioned texture maps \*Point sprites \*Separate stencil operations for RGB and alpha \*Rendering to multiple color buffers using GLSL Most importantly, this edition discusses the OpenGL Shading Language (GLSL) and explains the mechanics of using this new language to create complex graphics effects and boost the computational power of OpenGL. The Official Guide to Learning OpenGL, Version 2 Inside cover 1 Contents 5 What's new in this edition 36 Plates 479 Chapter 1 47 What is OpenGL 48 A Smidgen of OpenGL code 51 OpenGL Command Syntax 53 OpenGL as a State Machine 55 OpenGL Rendering Pipeline 56 Display Lists 57 Evaluators 57 Per-Vertex Operations 58 Primitive Assembly 58 Pixel Operations 58 Texture Assembly 59 Rasterization 59 Fragment Operations 59 OpenGL-Related Libraries 60 Include Files 61 GLUT, the OpenGL Utility Toolkit 62 Animation 66 The Refresh That Pauses 68 Motion = Redraw + Swap 69 Chapter 2 73 A Drawing Survival Kit 75 Clearing the Window 76 Specifying a Color 78 Forcing Completion of Drawing 80 Coordinate System Survival Kit 82 Describing Points,Lines and Polygons 83 What Are Points, Lines and Polygons? 83 Specifying Vertices 87 OpenGL Geometric Drawing Primitives 88 Basic State Management 94 Displaying Points,Lines and Polygons 96 Point Details 96 Line Details 97 Polygon Details 101 Normal Vectors 109 Vertex Arrays 111 Step 1: Enabling Arrays 113 Step 2: Specifying Data for the Arrays 114 Step 3: Dereferencing and Rendering 117 Interleaved Arrays 124 Vertex Arrays in Buffer Objects 128 Utilizing Buffer Objects with Vertex-Array Data 128 Creating Buffer Objects for Vertex Data 129 Making a Buffer Object Active 129 Allocating and Initialising Buffer Objects with Vertex Data 130 Updating Data Values in Buffer Objects 134 Cleaning up Buffer Objects 136 Attribute Groups 136 Some Hints for Building Polygonal Models of Surfaces 139 An Example: Building an Icosahedron 141 Chapter 3 149 Overview: The Camera Analogy 152 A Simple Example: Drawing a Cube 155 General-Purpose Transformation Commands 160 Viewing and Modeling Transformations 163 Thinking about Transformations 163 Modeling Transformations 166 Viewing Transformations 172 Projection Transformations 179 Perspective Projection 179 Orthographic Projection 182 View Volume Clipping 184 Viewport Transformation 184 Defining the Viewport 185 The Transformed Depth Coordinate 187 Troubleshooting Transformations 188 Manipulating the Matrix Stacks 191 The Modelview Matrix Stack 194 The Projection Matrix Stack 194 Additional Clipping Planes 195 Examples of Composing Several Transformations 198 Building a Solar System 199 Building an Articulated Robot Arm 202 Reversing or Mimicking Transformations 206 Chapter 4 211 Color Perception 212 Computer Color 214 RGBA verus Color-Index Mode 216 RGBA Display Mode 217 Color-Index Display Mode 219 Choosing between RGBA and Color-Index Mode 221 Changing between Display Modes 222 Specifying a Color and a Shading Model 222 Specifying a Color in RGBA Mode 223 Specifying a Color in Color-Index Mode 224 Chapter 5 229 A Hidden-Surface Removal Survival Kit 231 Real-World and OpenGL Lighting 233 Ambient, Diffuse, Specular and Emissive Light 234 Material Colors 235 RGB Values for Lights and Materials 235 A Simple Example: Rendering a Lit Sphere 236 Creating Light Sources 240 Color 242 Position and Attenuation 243 Spotlights 245 Multiple Lights 246 Controlling a Light's Position and Direction 247 Selecting a Lighting Model 253 Global Ambient Light 254 Local of Infinite Viewport 255 Two-Sided Lighting 255 Secondary Specular Color 256 Enabling Lighting 257 Defining Material Properties 257 Diffuse and Ambient Reflection 259 Specular Reflection 260 Emission 260 Changing Material Properties 261 Color Material Mode 263 The Mathematics of Lighting 266 Material Emission 267 Scaled Global Ambient Light 268 Contributions from Light Sources 268 Putting it All Together 270 Secondary Specular Color 271 Lighting in Color-Index Mode 272 The Mathematics of Color-Index Mode Lighting 273 Chapter 6 275 Blending 277 The Source and Destination Factors 278 Enabling Blending 281 Combining Pixels Using Blending Equations 281 Sample Uses of Blending 284 A Blending Example 286 Three-Dimensional Blending with the Depth Buffer 289 Antialiasing 293 Antialiasing Points or Lines 295 Antialiasing Geometric Primitives with Multisampling 301 Antialiasing Polygons 305 Fog 307 Using Fog 307 Fog Equations 310 Point Parameters 317 Polygon Offset 320 Chapter 7 323 Why Use Display Lists? 324 An Example of Using a Display List 325 Display List Design Philosophy 328 Creating and Executing a Display List 331 Naming and Creating a Display List 332 What's Stored in a Display List? 333 Executing a Display List 335 Hierarchical Display Lists 336 Managing Display List Indices 337 Executing Multiple Display Lists 338 Managing State Variables with Display Lists 343 Encapsulating Mode Changes 345 Chapter 8 347 Bitmaps and Fonts 349 The Current Raster Position 351 Drawing the Bitmap 352 Choosing a Color for the Bitmap 354 Fonts and Display Lists 355 Defining and Using a Complete Font 356 Images 358 Reading, Writing and Copying Pixel Data 359 Imaging Pipeline 367 Pixel Packing and Unpacking 370 Controlling Pixel-Storage Modes 371 Pixel-Transfer Operations 376 Pixel Mapping 379 Magnifying,Reducing or Flipping an Image 380 Reading and Drawing Pixel Reactangles 383 The Pixel Rectangle Drawing Process 384 Tips for Improving Pixel Drawing Rates 387 Imaging Subset 388 Color Tables 390 Convolutions 395 Color Matrix 403 Histogram 405 Minmax 408 Chapter 9 411 An Overview and an Example 417 Steps in Texture Mapping 417 A Sample Program 418 Specifying the Texture 421 Texture Proxy 426 Replacing All or Part of a Texture Image 428 One-Dimensional Textures 431 Three-Dimensional Textures 433 Compressed Texture Images 438 Using a Texture's Borders 441 Mipmap: Multiple Levels of Detail 441 Filtering 452 Texture Objects 455 Naming a Texture Object 456 Creating and Using Texture Objects 456 Cleaning Up Texture Objects 459 A Working Set of Resident Textures 460 Texture Functions 462 Assigning Texture Coordinates 466 Computing Appropriate Texture Coordiantes 468 Repeating and Clamping Textures 469 Automatic Texure-Coordinate Generation 475 Creating Contours 476 Sphere Map 496 Cube Map Textures 498 Multitexturing 500 Texture Combiner Functions 506 The Interpolation Combiner Function 510 Applying Secondary Color after Texturing 512 Secondary Color When Lighting is Disabled 512 Secondary Specular Color When Lighting is Enabled 512 The Texture Matric Stack 513 Depth Textures 514 Creating a Shadow Map 515 Generating Texture Coordinates and Rendering 516 Chapter 10 519 Buffers and Their Uses 522 Color Buffers 523 Clearing Buffers 524 Selecting Color Buffers for Writing and Reading 525 Masking Buffers 527 Testing and Operating on Fragments 529 Scissor Test 530 Alpha Test 530 Stencil Test 532 Depth Test 537 Occlusion Query 538 Blending, Dithering and Logical Operations 541 The Accumulation Buffer 544 Scene Antialiasing 545 Motion Blur 551 Depth of Field 551 Soft Shadows 556 Jittering 556 Chapter 11 559 Polygon Tessellation 560 Creating a Tessellation Object 562 Tessellation Callback Routines 562 Tessellation Properties 567 Polygon Definition 572 Deleting a Tessellation Object 575 Backward Compatibility 576 Quadrics: Rendering Sphere, Cylinders and Disks 577 Managing Quadrics Objects 578 Controlling Quadrics Attributes 579 Quadrics Primitives 581 Chapter 12 587 Prerequisites 589 Evaluators 590 One-Dimensional Evaluators 590 Two-Dimensional Evaluators 596 Using Evaluators for Textures 602 The GLU NURBS Interface 604 A Simple NURBS Example 604 Managing a NURBS Object 609 Creating a NURBS Curve of Surface 613 Trimming a NURBS Surface 619 Chapter 13 623 Selection 624 The Basic Steps 625 Creating the Name Stack 626 The Hit Record 628 A Selection Example 629 Picking 632 Hints for Writing a Program That Uses Selection 643 Feedback 645 The Feedback Array 647 Using Markers in Feedback Mode 648 A Feedback Example 648 Chapter 14 653 Error Handling 655 Which Version Am I Using 657 Utility Library Version 658 Window System Extension Versions 659 Extensions to the Standard 659 Extensions to the Standard for Microsoft Windows(WGL) 661 Cheesy Translucency 662 An Easy Fade Effect 662 Object Selection Using the Back Buffer 664 Cheap Image Transformation 665 Displaying Layers 666 Antialiased Characters 667 Drawing Round Points 670 Interpolating Images 670 Making Decals 670 Drawing Filled,Concave Polygons Using the Stencil Buffer 672 Finding Interface Regions 673 Shadows 675 Hidden Line Removal 676 Hidden Line Removal with Polygon Offset 676 Hidden Line Removal with the Stencil Buffer 677 Texture Mapping Applications 678 Drawing Depth-Buffered Images 679 Dirichlet Domains 679 Life in the Stencil Buffer 681 Alternative Uses for glDrawPixels() and glCopyPixles 682 Chapter 15 685 Why OpenGL 2.0? 686 Point Sprites 686 The OpenGL Graphics Pipeline and Programmable Shading 688 Vertex Processing 689 Fragment Processing 691 Using GLSL Shaders 692 A Sample Shader 692 OpenGL/GLSL Interface 693 The OpenGL Shading Language 700 Creating Shaders with GLSL 701 The Starting Point 701 Declaring Variables 701 Aggregate Types 703 Statements 710 Functions 713 Using OpenGL State Values in GLSL Programs 715 Accessing Texture Maps in Shaders 715 Vertex Shader Specifics 717 Fragment Shaders 724 Appendix A 727 Appendix B 733 Appendix C 775 Appendix D 799 Appendix E 807 Appendix F 813 Appendix G 819 Appendix H 825 Appendix I 829 Glossary 853 Index 875 OpenGL is a powerful software interface used to produce high-quality, computer-generated images and interactive applications using 2D and 3D objects, bitmaps, and color images.The OpenGL Programming Guide, Fifth Edition, provides definitive and comprehensive information on OpenGL and the OpenGL Utility Library. The previous edition covered OpenGL through Version 1.4. This fifth edition of the best-selling "red book" describes the latest features of OpenGL Versions 1.5 and 2.0, including the introduction of the OpenGL Shading Language.You will find clear explanations of OpenGL functionality and many basic computer graphics techniques, such as building and rendering 3D models; interactively viewing objects from different perspective points; and using shading, lighting, and texturing effects for greater realism. In addition, this book provides in-depth coverage of advanced techniques, including texture mapping, antialiasing, fog and atmospheric effects, NURBS, image processing, and more. The text also explores other key topics such as enhancing performance, OpenGL extensions, and cross-platform techniques.Most importantly, this edition discusses the OpenGL Shading Language (GLSL) and explains the mechanics of using this new language to create complex graphics effects and boost the computational power of OpenGL.The OpenGL Technical Library provides tutorial and reference books for OpenGL. The Library enables programmers to gain a practical understanding of OpenGL and shows them how to unlock its full potential. Originally developed by SGI, the Library continues to evolve under the auspices of the Architecture Review Board (ARB), an industry consortium responsible for guiding the evolution of OpenGL and related technologies. The OpenGL ARB is composed of leaders in the computer graphics industry: 3Dlabs, Apple, ATI, Dell, IBM, Intel, NVIDIA, SGI, and Sun Microsystems. OpenGL is a powerful software interface used to produce high-quality, computer-generated images and interactive applications using 2D and 3D objects, bitmaps, and color images. The OpenGL Programming Guide, Fifth Edition, provides definitive and comprehensive information on OpenGL and the OpenGL Utility Library. The previous edition covered OpenGL through Version 1.4. This fifth edition of the best-selling "red book" describes the latest features of OpenGL Versions 1.5 and 2.0, including the introduction of the OpenGL Shading Language. You will find clear explanations of OpenGL functionality and many basic computer graphics techniques, such as building and rendering 3D models; interactively viewing objects from different perspective points; and using shading, lighting, and texturing effects for greater realism. In addition, this book provides in-depth coverage of advanced techniques, including texture mapping, antialiasing, fog and atmospheric effects, NURBS, image processing, and more. The text also explores other key topics such as enhancing performance, OpenGL extensions, and cross-platform techniques. This fifth edition has been extensively updated to include the newest features of OpenGL Versions 1.5 and 2.0, Most importantly, this edition discusses the OpenGL Shading Language (GLSL) and explains the mechanics of using this new language to create complex graphics effects and boost the computational power of OpenGL.
دانلود کتاب راهنمای برنامه‌نویسی OpenGL: راهنمای رسمی یادگیری OpenGL، نسخه ۲ (ویرایش پنجم)