Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
50% found this document useful (2 votes)
10K views

Computer Graphics Programming in OpenGL with Java 3rd Edition V. Scott Gordon 2024 Scribd Download

The document promotes the ebook 'Computer Graphics Programming in OpenGL with Java, 3rd Edition' by V. Scott Gordon, available for download on ebookmeta.com. It includes links to additional related ebooks and outlines the contents and licensing information of the main book. The book covers various topics in computer graphics programming using OpenGL and Java, including graphics pipeline, mathematical foundations, and advanced techniques like lighting and shadows.

Uploaded by

hanseabajayq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
10K views

Computer Graphics Programming in OpenGL with Java 3rd Edition V. Scott Gordon 2024 Scribd Download

The document promotes the ebook 'Computer Graphics Programming in OpenGL with Java, 3rd Edition' by V. Scott Gordon, available for download on ebookmeta.com. It includes links to additional related ebooks and outlines the contents and licensing information of the main book. The book covers various topics in computer graphics programming using OpenGL and Java, including graphics pipeline, mathematical foundations, and advanced techniques like lighting and shadows.

Uploaded by

hanseabajayq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Get the full ebook with Bonus Features for a Better Reading Experience on ebookmeta.

com

Computer Graphics Programming in OpenGL with Java


3rd Edition V. Scott Gordon

https://ebookmeta.com/product/computer-graphics-programming-
in-opengl-with-java-3rd-edition-v-scott-gordon/

OR CLICK HERE

DOWLOAD NOW

Download more ebook instantly today at https://ebookmeta.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Computer graphics programming in OpenGL with C 2nd


Edition V Scott Gordon

https://ebookmeta.com/product/computer-graphics-programming-in-opengl-
with-c-2nd-edition-v-scott-gordon/

ebookmeta.com

Introduction to Computer Graphics: Using OpenGL and Java,


3rd Edition Karsten Lehn

https://ebookmeta.com/product/introduction-to-computer-graphics-using-
opengl-and-java-3rd-edition-karsten-lehn/

ebookmeta.com

Developing Graphics Frameworks With Java and OpenGL 1st


Edition Lee Stemkoski

https://ebookmeta.com/product/developing-graphics-frameworks-with-
java-and-opengl-1st-edition-lee-stemkoski/

ebookmeta.com

Engaged Learners and Digital Citizens Critical Outcomes


for Teaching and Learning 1st Edition Brad Garner

https://ebookmeta.com/product/engaged-learners-and-digital-citizens-
critical-outcomes-for-teaching-and-learning-1st-edition-brad-garner/

ebookmeta.com
The Spy Whisperer 1st Edition Matthew Dunn

https://ebookmeta.com/product/the-spy-whisperer-1st-edition-matthew-
dunn/

ebookmeta.com

Case Files Family Medicine, 4e 4th Edition Donald Briscoe

https://ebookmeta.com/product/case-files-family-medicine-4e-4th-
edition-donald-briscoe/

ebookmeta.com

Advanced Therapeutics in Pain Medicine First Edition Sahar


Swidan

https://ebookmeta.com/product/advanced-therapeutics-in-pain-medicine-
first-edition-sahar-swidan/

ebookmeta.com

Gingerbear Christmas Howls Romance Howliday Special 1st


Edition Reina Torres Torres Reina

https://ebookmeta.com/product/gingerbear-christmas-howls-romance-
howliday-special-1st-edition-reina-torres-torres-reina/

ebookmeta.com

Resonating System What To Perceive So You Can Receive


Resonation Realm Book 1 2nd Edition Rinzen Joye

https://ebookmeta.com/product/resonating-system-what-to-perceive-so-
you-can-receive-resonation-realm-book-1-2nd-edition-rinzen-joye/

ebookmeta.com
Beaded By Midnight A curvy girl and brother s best friend
romance 1st Edition Eve London

https://ebookmeta.com/product/beaded-by-midnight-a-curvy-girl-and-
brother-s-best-friend-romance-1st-edition-eve-london/

ebookmeta.com
Computer Graphics
Programming in OpenGL
with Java
Third Edition

CGP.Java3E.Ch00.FM.2pp.indd 1 8/17/2021 12:04:50 PM


LICENSE, DISCLAIMER OF LIABILITY, AND LIMITED WARRANTY

By purchasing or using this book and its companion files (the “Work”), you agree
that this license grants permission to use the contents contained herein, but does
not give you the right of ownership to any of the textual content in the book or
ownership to any of the information or products contained in it. This license does
not permit uploading of the Work onto the Internet or on a network (of any kind)
without the written consent of the Publisher. Duplication or dissemination of any
text, code, simulations, images, etc. contained herein is limited to and subject to
licensing terms for the respective products, and permission must be obtained from
the Publisher or the owner of the content, etc., in order to reproduce or network any
portion of the textual material (in any media) that is contained in the Work.

Mercury Learning and Information (“MLI” or “the Publisher”) and


anyone involved in the creation, writing, or production of the companion disc,
accompanying algorithms, code, or computer programs (“the software”), and any
accompanying Web site or software of the Work, cannot and do not warrant the
performance or results that might be obtained by using the contents of the Work.
The author, developers, and the Publisher have used their best efforts to ensure
the accuracy and functionality of the textual material and/or programs contained
in this package; we, however, make no warranty of any kind, express or implied,
regarding the performance of these contents or programs. The Work is sold “as is”
without warranty (except for defective materials used in manufacturing the book
or due to faulty workmanship).

The author, developers, and the publisher of any accompanying content, and anyone
involved in the composition, production, and manufacturing of this work will not
be liable for damages of any kind arising out of the use of (or the inability to use)
the algorithms, source code, computer programs, or textual material contained
in this publication. This includes, but is not limited to, loss of revenue or profit,
or other incidental, physical, or consequential damages arising out of the use of
this Work.

The sole remedy in the event of a claim of any kind is expressly limited to
replacement of the book and disc and only at the discretion of the Publisher. The
use of “implied warranty” and certain “exclusions” vary from state to state, and
might not apply to the purchaser of this product.

Companion files are available for download from the publisher by writing to
info@merclearning.com.

CGP.Java3E.Ch00.FM.2pp.indd 2 8/17/2021 12:04:50 PM


Computer Graphics
Programming in OpenGL
with Java
Third Edition

V. Scott Gordon, PhD


California State University, Sacramento

John Clevenger, PhD


California State University, Sacramento

Mercury Learning and Information


Dulles, Virginia
Boston, Massachusetts
New Delhi

CGP.Java3E.Ch00.FM.2pp.indd 3 8/17/2021 12:04:50 PM


Copyright ©2021 by Mercury Learning and Information LLC. All rights reserved.

This publication, portions of it, or any accompanying software may not be reproduced in any way,
stored in a retrieval system of any type, or transmitted by any means, media, electronic display
or mechanical display, including, but not limited to, photocopy, recording, Internet postings, or
scanning, without prior permission in writing from the publisher.

Publisher: David Pallai

Mercury Learning and Information


22841 Quicksilver Drive
Dulles, VA 20166
info@merclearning.com
www.merclearning.com
(800) 232-0223

V. Scott Gordon & John Clevenger.


Computer Graphics Programming in OpenGL with Java, Third Edition
ISBN: 978-1-68392-736-5

The publisher recognizes and respects all marks used by companies, manufacturers, and
developers as a means to distinguish their products. All brand names and product names mentioned
in this book are trademarks or service marks of their respective companies. Any omission or misuse
(of any kind) of service marks or trademarks, etc. is not an attempt to infringe on the property
of others.

Library of Congress Control Number: 2021942460

212223 321 Printed on acid-free paper in the United States of America.

Our titles are available for adoption, license, or bulk purchase by institutions, corporations, etc.
For additional information, please contact the Customer Service Dept. at 800-232-0223 (toll free).
Digital versions of our titles are available at: www.academiccourseware.com and other e-vendors.
All companion files are available by writing to the publisher at info@merclearning.com.

The sole obligation of Mercury Learning and Information to the purchaser is to replace
the book and/or disc, based on defective materials or faulty workmanship, but not based on the
operation or functionality of the product.

CGP.Java3E.Ch00.FM.2pp.indd 4 8/17/2021 12:04:50 PM


Contents
Preface xi
What’s New in This Edition xiii
Intended Audience xiv
How to Use This Book xv
Acknowledgments xvii
About the Authors xix

Chapter 1 Getting Started 1


1.1 Languages and Libraries 1
1.1.1 Java 2
1.1.2 OpenGL / GLSL 2
1.1.3 JOGL 3
1.1.4 JOML 3
1.2 Installation and Configuration 4

Chapter 2 The OpenGL Graphics Pipeline 5


2.1 The OpenGL Pipeline 6
2.1.1 Java/JOGL Application 7
2.1.2 Vertex and Fragment Shaders 10
2.1.3 Tessellation 15
2.1.4 Geometry Shader 16
2.1.5 Rasterization 17
2.1.6 Fragment Shader 19
2.1.7 Pixel Operations 20

CGP.Java3E.Ch00.FM.2pp.indd 5 8/17/2021 12:04:51 PM


vi ■ C o n ten ts

2.2 Detecting OpenGL and GLSL Errors 21


2.3 Reading GLSL Source Code from Files 26
2.4 Building Objects from Vertices 27
2.5 Animating a Scene 28
2.6 Organizing the Java Code Files 32

Chapter 3 Mathematical Foundations 37


3.1 3D Coordinate Systems 38
3.2 Points 38
3.3 Matrices 39
3.4 Transformation Matrices 42
3.4.1 Translation 42
3.4.2 Scaling 43
3.4.3 Rotation 44
3.5 Vectors 45
3.5.1 Uses for Dot Product 47
3.5.2 Uses for Cross Product 48
3.6 Local and World Space 49
3.7 Eye Space and the Synthetic Camera 50
3.8 Projection Matrices 53
3.8.1 The Perspective Projection Matrix 53
3.8.2 The Orthographic Projection Matrix 56
3.9 Look-At Matrix 57
3.10 GLSL Functions for Building Matrix Transforms 58

Chapter 4 Managing 3D Graphics Data 63


4.1 Buffers and Vertex Attributes 64
4.2 Uniform Variables 67
4.3 Interpolation of Vertex Attributes 68
4.4 Model-View and Perspective Matrices 69
4.5 Our First 3D Program—A 3D Cube 71
4.6 Rendering Multiple Copies of an Object 80
4.6.1 Instancing 81
4.7 Rendering Multiple Different Models in a Scene 84
4.8 Matrix Stacks 87
4.9 Combating “Z-Fighting” Artifacts 94
4.10 Other Options for Primitives 95
4.11 Coding for Performance 97

CGP.Java3E.Ch00.FM.2pp.indd 6 8/17/2021 12:04:51 PM


C onte nts ■ vii

4.11.1 Minimizing Dynamic Memory Allocation 97


4.11.2 Pre-Computing the Perspective Matrix 99
4.11.3 Back-Face Culling 100

Chapter 5 Texture Mapping 107


5.1 Loading Texture Image Files 108
5.2 Texture Coordinates 110
5.3 Creating a Texture Object 112
5.4 Constructing Texture Coordinates 112
5.5 Loading Texture Coordinates into Buffers 114
5.6 Using the Texture in a Shader: Sampler Variables and Texture Units 114
5.7 Texture Mapping: Example Program 115
5.8 Mipmapping 118
5.9 Anisotropic Filtering 123
5.10 Wrapping and Tiling 124
5.11 Perspective Distortion 126
5.12 Loading Texture Image Files using Java AWT Classes 128

Chapter 6 3D Models 133


6.1 Procedural Models—Building a Sphere 134
6.2 OpenGL Indexing—Building a Torus 142
6.2.1 The Torus 142
6.2.2 Indexing in OpenGL 143
6.3 Loading Externally Produced Models 148

Chapter 7 Lighting 161


7.1 Lighting Models 161
7.2 Lights 163
7.3 Materials 166
7.4 ADS Lighting Computations 168
7.5 Implementing ADS Lighting 171
7.5.1 Gouraud Shading 172
7.5.2 Phong Shading 180
7.6 Combining Lighting and Textures 185

Chapter 8 Shadows 191


8.1 The Importance of Shadows 191
8.2 Projective Shadows 192

CGP.Java3E.Ch00.FM.2pp.indd 7 8/17/2021 12:04:51 PM


viii ■ Co n te n ts

8.3 Shadow Volumes 193


8.4 Shadow Mapping 194
8.4.1 Shadow Mapping (Pass One)—“Draw” Objects from
Light Position 195
8.4.2 Shadow Mapping (Intermediate Step)—Copying the
Z-Buffer to a Texture 196
8.4.3 Shadow Mapping (Pass Two)—Rendering the Scene with
Shadows 197
8.5 A Shadow Mapping Example 201
8.6 Shadow Mapping Artifacts 208
8.7 Soft Shadows 210
8.7.1 Soft Shadows in the Real World 211
8.7.2 Generating Soft Shadows—Percentage Closer Filtering (PCF) 212
8.7.3 A Soft Shadow/PCF Program 216

Chapter 9 Sky and Backgrounds 221


9.1 Skyboxes 221
9.2 Skydomes 224
9.3 Implementing a Skybox 226
9.3.1 Building a Skybox from Scratch 226
9.3.2 Using OpenGL Cube Maps 229
9.4 Environment Mapping 234

Chapter 10 Enhancing Surface Detail 243


10.1 Bump Mapping 243
10.2 Normal Mapping 245
10.3 Height Mapping 254

Chapter 11 Parametric Surfaces 261


11.1 Quadratic Bézier Curves 261
11.2 Cubic Bézier Curves 263
11.3 Quadratic Bézier Surfaces 266
11.4 Cubic Bézier Surfaces 268

Chapter 12 Tessellation 273


12.1 Tessellation in OpenGL 273
12.2 Tessellation for Bézier Surfaces 279
12.3 Tessellation for Terrain/Height Maps 286
12.4 Controlling Level of Detail (LOD) 293

CGP.Java3E.Ch00.FM.2pp.indd 8 8/17/2021 12:04:51 PM


C onte nts ■ ix

Chapter 13 Geometry Shaders 299


13.1 Per-Primitive Processing in OpenGL 299
13.2 Altering Primitives 301
13.3 Deleting Primitives 305
13.4 Adding Primitives 306
13.5 Changing Primitive Types 309

Chapter 14 Other Techniques 313


14.1 Fog 313
14.2 Compositing/Blending/Transparency 316
14.3 User-Defined Clipping Planes 322
14.4 3D Textures 324
14.5 Noise 330
14.6 Noise Application - Marble 335
14.7 Noise Application - Wood 340
14.8 Noise Application - Clouds 344
14.9 Noise Application - Special Effects 349

Chapter 15 Simulating Water 355


15.1 Pool Surface and Floor Geometry Setup 355
15.2 Adding Surface Reflection and Refraction 360
15.3 Adding Surface Waves 371
15.4 Additional Corrections 374
15.5 Animating the Water Movement 379
15.6 Underwater Caustics 381

Chapter 16 Ray Tracing and Compute Shaders 387


16.1 Compute Shaders 389
16.1.1 Compiling and Using Compute Shaders 389
16.1.2 Parallel Computing in Compute Shaders 390
16.1.3 Work Groups 394
16.1.4 Work Group Details 395
16.1.5 Work Group Limitations 398
16.2 Ray Casting 399
16.2.1 Defining the 2D Texture Image 399
16.2.2 Building and Displaying the Ray Cast Image 400
16.2.3 Ray-Sphere Intersection 408
16.2.4 Axis-Aligned Ray-Box Intersection 409

CGP.Java3E.Ch00.FM.2pp.indd 9 8/17/2021 12:04:51 PM


x ■ C o n te n ts

16.2.5 Output of Simple Ray Casting Without Lighting 411


16.2.6 Adding ADS Lighting 411
16.2.7 Adding Shadows 413
16.2.8 Non-Axis-Aligned Ray-Box Intersection 415
16.2.9 Determining Texture Coordinates 418
16.2.10 Plane Intersection and Procedural Textures 426
16.3 Ray Tracing 430
16.3.1 Reflection 430
16.3.2 Refraction 434
16.3.3 Combining Reflection, Refraction, and Textures 437
16.3.4 Increasing the Number of Rays 439
16.3.5 Generalizing the Solution 446
16.3.6 Additional Examples 450
16.3.7 Blending Colors for Transparent Objects 455

Chapter 17 Stereoscopy for 3D Glasses and VR Headsets 467


17.1 View and Projection Matrices for Two Eyes 469
17.2 Anaglyph Rendering 471
17.3 Side-by-Side Rendering 474
17.4 Correcting Lens Distortion in Headsets 475
17.5 A Simple Testing Hardware Configuration 483

Appendix A Installation and Setup for PC (Windows) 487


Appendix B Installation and Setup for Macintosh 491
Appendix C Using the Nsight Graphics Debugger 497

Index 505

CGP.Java3E.Ch00.FM.2pp.indd 10 8/17/2021 12:04:51 PM


Preface
This book is designed primarily as a textbook for a typical computer science ­undergraduate
course in modern shader-based, OpenGL 3D graphics programming. However, we have
also endeavored to create a text that could be used to teach oneself, without an accom-
panying course. With both of those aims in mind, we have tried to explain things as
clearly and as simply as we can. All of the programming examples are stripped down and
­simplified as much as possible, but they are still complete, so the reader may run them all
as presented.

One of the things we hope is unique about this book is that we have strived to make it
accessible to a beginner – that is, someone new to 3D graphics programming. While there
is by no means a lack of information available on the topic—quite the contrary—many
students are initially overwhelmed. This text is our attempt to write the book we wish we
had had when we were starting out, with step-by-step explanations of the basics, progress-
ing in an organized manner up through advanced topics. We considered titling the book
“shader programming made easy”; however, we don’t think that there really is any way of
making shader programming “easy.” We hope that we have come close.

This book teaches OpenGL programming in Java, using JOGL—a Java “wrapper”
for OpenGL’s native C calls [JO21]. There are several advantages to learning graphics
programming in Java rather than in C:
• It is more convenient for students at schools that conduct most of their curriculum
in Java
• Installation and setup is easier in Java than for C or C++
• Java’s I/O, window, and event handling are arguably cleaner than in C

CGP.Java3E.Ch00.FM.2pp.indd 11 8/17/2021 12:04:51 PM


xii ■ Pr e fa c e

• Java’s excellent support for object-oriented design patterns can foster good design
• JOGL includes some very nice tools, such as for loading textures, animation
loops, etc.
It is worth mentioning that there do exist other Java bindings for OpenGL. One that
has become very popular is Lightweight Java Game Library, or LWJGL [LW21]. Like
JOGL, LWJGL also offers bindings for OpenAL and OpenCL. This textbook focuses
only on JOGL.

Another thing that makes this book unique is that it has a “sister” textbook: Computer
Graphics Programming in OpenGL with C++, Second Edition. The two books are orga-
nized in lockstep, with the same chapter and section numbers and topics, figures, exer-
cises, and theoretical descriptions. Wherever possible, the code is organized similarly.
Of course, the use of Java versus C++ leads to considerable programming differences
(although all of the shader code is identical). Still, we believe that we have provided vir-
tually identical learning paths, even allowing a student to choose either option within a
single classroom.

An important point of clarification is that there exist both different versions of


OpenGL (briefly discussed later) and different variants of OpenGL. For example, in
addition to “standard OpenGL” (sometimes called “desktop OpenGL”), there exists a
variant called “OpenGL ES,” which is tailored for development of embedded systems
(hence the “ES”). “Embedded systems” include devices such as mobile phones, game
consoles, automobiles, and industrial control systems. OpenGL ES is mostly a subset of
standard OpenGL, eliminating a large number of operations that are typically not needed
for embedded systems. OpenGL ES also adds some additional functionality, typically
application-specific operations for particular target environments. The JOGL suite of Java
bindings includes interfaces for different versions of OpenGL ES, although we do not use
them in this book.

Yet another variant of OpenGL is called “WebGL.” Based on OpenGL ES, WebGL is
designed to support the use of OpenGL in web browsers. WebGL allows an application to
use JavaScript1 to invoke OpenGL ES operations, which makes it easy to embed OpenGL
graphics into standard HTML (web) documents. Most modern web browsers support
WebGL, including Apple Safari, Google Chrome, Microsoft Edge, Microsoft Internet
Explorer, Mozilla Firefox, and Opera. Since web programming is outside the scope of
this book, we will not cover any WebGL specifics. Note however, that because WebGL

1 JavaScript is a scripting language that can be used to embed code in web pages. It has strong
similarities to Java, but also many important differences.

CGP.Java3E.Ch00.FM.2pp.indd 12 8/17/2021 12:04:51 PM


Pre fa c e ■ xiii

is based on OpenGL ES, which in turn is based on standard OpenGL, much of what is
covered in this book can be transferred directly to learning about these OpenGL variants.

The very topic of 3D graphics lends itself to impressive, even beautiful images.
Indeed, many popular textbooks on the topic are filled with breathtaking scenes, and it is
enticing to leaf through their galleries. While we acknowledge the motivational utility of
such examples, our aim is to teach, not to impress. The images in this book are simply the
outputs of the example programs, and because this is an introductory text, the resulting
scenes are unlikely to impress an expert. However, the techniques presented do constitute
the foundational elements for producing today’s stunning 3D effects.

We also haven’t tried to create an OpenGL or JOGL “reference.” Our coverage of


OpenGL and JOGL represents only a tiny fraction of their capabilities. Rather, our aim is
to use OpenGL and JOGL as vehicles for teaching the fundamentals of modern shader-
based 3D graphics programming, and provide the reader with a sufficiently deep under-
standing for further study. If along the way this text helps to expand awareness of JOGL
and other JogAmp technologies, that would be nice, too.

What’s New in This Edition


We have added three new chapters in this 3rd edition of Computer Graphics Programming
in OpenGL with Java:
• Chapter 15 – Simulating Water
• Chapter 16 – Ray Tracing
• Chapter 17 – Stereoscopy
Ray tracing in particular has become “hot” recently, so we are especially excited that
it is now included in our book. It is also a huge topic, so even though our coverage is just
a basic introduction, Chapter 16 is now the longest chapter in the book. Chapter 16 also
includes an introduction to compute shaders, which were introduced in OpenGL 4.3, and
an introduction to additive and subtractive color blending, which expands on a topic that
was introduced in Section 14.2.

For years our own students have repeatedly expressed an interest in simulating water.
However, water takes so many forms that writing an introductory section on the topic is
challenging. Ultimately, we decided to present water in a way that would complement
related topics in the book such as terrain, sky, etc., and so in Chapter 15 we focus on utiliz-
ing our noise maps from Chapter 14 to generate water surfaces such as are seen in lakes
and oceans.

CGP.Java3E.Ch00.FM.2pp.indd 13 8/17/2021 12:04:51 PM


xiv ■ P refa c e

The new chapter on stereoscopy is motivated by the increased popularity of virtual


reality. However, it is also applicable to the development of animation for “3D movies,”
and we have tried to provide introductory coverage of both uses equally.

As a result of these additions, this 3rd edition is larger than the previous edition.

Besides the new material, there are important revisions throughout the book. For
example, we fixed bugs in our Torus class in Chapter 6, and made significant improve-
ments to our noise map functions in Chapter 14. Another small, but important, modifica-
tion was to change all of our lighting computations so that they are done in world space
rather than in camera space – this makes it easier to develop applications that require
being able to move the camera around. We also expanded our Utils.java utility class to
handle the loading of compute shaders.

There are dozens of small changes in every chapter that the reader might not even
notice: fixing typos, cleaning up code inconsistencies, updating the installation instruc-
tions, making slight wording changes, sprucing up figures, updating references, etc.
Completely eliminating typos is virtually impossible in a book that covers an ever-chang-
ing technology-rich topic, but we have attempted it.

Intended Audience
This book is targeted at students of computer science. This could mean undergraduates
pursuing a BS degree, but it could also mean anyone who studies computer science. As
such, we are assuming that the reader has at least a solid background in object-oriented
programming, at the level of someone who is, say, a computer science major at the junior
or senior level.

There are also some specific things that we use in this book, but that we don’t cover,
because we assume the reader already has sufficient background. In particular:
• Java and its Abstract Window Toolkit (AWT) or Swing library, especially for
GUI-building
• Java configuration details, such as manipulating the CLASSPATH
• basic data structures and algorithms, such as linked lists, stacks and queues, etc.
• recursion
• event-driven programming concepts
• basic matrix algebra and trigonometry
• basic analytic geometry, such as for defining points, lines, vectors, planes, and circles

CGP.Java3E.Ch00.FM.2pp.indd 14 8/17/2021 12:04:51 PM


Pre fa c e ■ xv

• awareness of color models, such as RGB, RGBA, etc.


• basic familiarity with C or C++ (some shader syntax is based on C)
The audience for this new 3rd edition is also hoped to be expanded by the similar
updates made for the 2nd edition of its “sister” textbook, Computer Graphics Programming
in OpenGL with C++. In particular, we envision a learning environment where students
are free to utilize either Java or C++ in the same classroom, selecting one or the other
book. The two texts cover the material sufficiently in lockstep that we have been conduct-
ing our graphics programming course successfully in this manner.

How to Use This Book


This book is designed to be read from front to back. That is, material in later chapters
frequently relies on information learned in earlier chapters. So, it probably won’t work to
jump back and forth in the chapters; rather, work your way forward through the material.

This is also intended mostly as a practical, hands-on guide. While there is plenty of
theoretical material included, the reader should treat this text as a sort of “workbook,” in
which you learn basic concepts by actually programming them yourself. We have pro-
vided code for all of the examples, but to really learn the concepts you will want to “play”
with those examples—extend them to build your own 3D scenes.

At the end of each chapter are a few exercises to solve. Some are very simple, involv-
ing merely making simple modifications to the provided code. The problems that are
marked “(PROJECT),” however, are expected to take some time to solve, and require writ-
ing a significant amount of code, or combining techniques from various examples. There
are also a few marked “(RESEARCH)”—those are problems that encourage independent
study because this textbook doesn’t provide sufficient detail to solve them.

OpenGL calls, whether made in C or in Java through JOGL, often involve long lists of
parameters. While writing this book, the authors debated whether or not to, in each case,
describe all of the parameters. We decided that in the early chapters we would describe
every detail. But as the topics progress, we decided to avoid getting bogged down in every
piece of minutiae in the OpenGL calls (and there are many), for fear of the reader losing
sight of the big picture. For this reason, it is essential when working through the examples
to have ready access to reference material for Java, OpenGL, and JOGL.

For this, there are a number of excellent reference sources that we recommend using
in conjunction with this book. The javadocs for Java and JOGL are absolutely essential,
and can be accessed online or downloaded. The reader should bookmark them for easy

CGP.Java3E.Ch00.FM.2pp.indd 15 8/17/2021 12:04:51 PM


Discovering Diverse Content Through
Random Scribd Documents
BLACK-THROATED DIVER.

Colymbus Arcticus, Linn.


PLATE CCCXLVI. Male, Female, and Young.

One of the most remarkable circumstances relative to this beautiful


bird, which is intermediate between the Red-throated Diver and the
Loon, is the extraordinary extent to which the wanderings of the
young are carried in autumn and winter. It breeds in the remote
regions of the north, from which many of the old birds, it would seem,
do not remove far, while the young, as soon as they are able to
travel, take to wing and disperse, spreading not only over the greater
part of the United States, but beyond their south-western limits. In
the Texas I saw individuals of this species as late as the middle of
April 1837; and I find it enumerated in a list of the birds observed by
my young friend Dr J. K. Townsend on the Columbia River, where
he also met with Columbus glacialis. Its ramblings over a
considerable portion of northern and eastern Europe have equally
been noted, and it has been found breeding in the extreme north of
Scotland.
For many years I knew the young of this bird only by the name
“Imber Diver,” applied by Bewick to that of another species, and now
have pleasure in looking upon a drawing of mine, made about thirty
years ago, with that appellation attached to it. Very few old birds in
full plumage have been procured within the limits of the United
States, and none in as far as I know, farther south than the Capes of
Delaware.
No sooner has the foliage of the trees that border our western waters
begun to drop and float on the gentle current of the fair Ohio, than
the Black-throated Diver makes its appearance there, moving slowly
with the stream. The Mississippi, Missouri, and their tributaries, are
at the same period supplied with these birds. Along our eastern and
southern shores they are seen from the end of autumn until spring.
Whilst in Labrador, I saw a few pairs courting on wing, much in the
manner of the Red-throated Diver; but all our exertions failed to
procure any of the nests, which I therefore think must have been
placed farther inland than those of the Loon or Red-throated Diver. I
observed however, that in their general habits they greatly resemble
those species, for on alighting on the water, they at once immerse
their bills, as if for the purpose of ascertaining whether it yields a
supply of suitable food, and afterwards raise themselves and beat
their wings.
This species has almost as powerful a flight as the Great Northern
Diver or Loon, and I think shoots through the air with even greater
velocity. When flying it moves its wings rapidly and continuously, and
has the neck and feet stretched out to their full length. I well recollect
that while I was standing near the shore of a large inlet in South
Carolina, one of these birds, being shot while passing over my head
at full speed, did not, on account of the impetus, reach the ground
until upwards of twenty yards beyond me. They are equally expert at
diving, and fully as much so in eluding the pursuit of their enemies
when wounded. I saw my friend Mr Harris bring down one from on
wing, on which Napoleon Coste, and William Taylor, Captains of
the Revenue Cutter and Tender of which we had the use, paddled in
pursuit of it in a light canoe; but, although they advanced with all the
address of Indians, they proved unsuccessful, for after following it
both in the Bay of Cayo Island, and in the Bay of Mexico, for nearly
an hour, they were obliged to return without it, having found it
apparently not in the least fatigued, although it had dived sufficiently
often to travel above two miles, shifting its course at each immersion.
It is curious to observe how carefully these birds avoid the danger of
sudden storms or heavy gales. On such occasions, I have seen
Divers at once seek the lee of rocks, islands, or artificial
embankments, where they could not only remain in security, but also
procure their accustomed food. At other times, when striving against
the tempest, they dive headlong from on wing, and are sure to
reappear in the smooth parts which sailors term the trough.
I once caught one of these birds on the Ohio, it having been
incapacitated from diving by having swallowed a large mussel, which
stuck in its throat. It was kept for several days, but refused food of
every kind, exhibited much bad humour, struck with its bill, and died
of inanition. The food of this species consists of fish, aquatic reptiles,
testaceous mollusca, and all sorts of small crustaceous animals. Its
flesh resembles that of the Loon, and is equally unfit to be eaten.
The eggs, which are sometimes two, more frequently three, average
three inches in length, by two in their greatest breadth, which is
about a third of the whole length distant from the extremity. Their
form is that of the Red-throated Diver, which however they exceed in
size. The shell is rather thick, the surface roughish, the ground
colour chocolate tinged with olive, sparingly spotted at the larger end
with very dark umber and black, and sprinkled all over with very
small dots of the same colour.
I have represented an adult male, a female, and a young bird.

Colymbus arcticus, Linn. Syst. Nat. vol. i. p. 221.—Lath. Ind. Ornith. vol. ii.
p. 800.—Ch. Bonaparte, Synopsis of Birds of United States, p. 420.
Colymbus arcticus, Black-throated Diver, Richards. and Swains. Fauna
Boreali-Americana, vol. ii. p. 475.
Black-throated Diver, Nuttall, Manual, vol. ii.

Adult Male. Plate CCCXLVI. Fig. 1.


Bill as long as the head, straight, stout, higher than broad at the
base, much compressed toward the end, and tapering to a point.
Upper mandible with the dorsal line descending and considerably
convex toward the end, the ridge convex, narrowed toward the point,
the sides convex beyond the nostrils, the edges involute for half their
length in the middle, direct at the base and toward the end, the tip
narrow and sharpish. Nasal groove rather long and narrowed;
nostrils sub-basal, linear, direct, pervious. Lower mandible with the
angle extremely narrow, and very long, the dorsal line ascending and
very slightly convex, the ridge convex and narrow, the edges sharp
and involute, the tip attenuated.
Head of moderate size, oblong, narrowed before. Neck rather long
and thick. Eyes of moderate size. Body elongated, much depressed,
of an elliptical form viewed from above. Wings small. Feet short,
rather large, placed very far back; tibia almost entirely concealed;
tarsus short, exceedingly compressed, sharp-edged before and
behind, covered all over with reticulated angular scales, hind toe
extremely small, externally marginate, connected with the second for
half its length by a membrane, which extends, narrowing, to the end;
the anterior toes connected by articulated membranes, the fourth or
outer longest, the third a little shorter, the second considerably
shorter than the third; all covered above with numerous narrow
scutella; the second toe with a free two-lobed membrane, the claws
very small, depressed, blunt.
Plumage short and dense, of the head and neck very short, soft and
blended; of the lower parts short, blended, stiffish, considerably
glossed; of the upper compact, glossy; the feathers on the lower part
of the sides of the neck much incurved, oblong with the terminal
barbs stiff; those of the fore part of the back and the scapulars
straight, oblong, abrupt. Wings proportionally very small and narrow,
curved; primaries strong, tapering, the first longest, the second
slightly shorter, the rest rapidly graduated; secondaries very short,
broad, and rounded. Tail extremely short, rounded, of eighteen
feathers.
Bill black. Iris deep bright red. Feet greyish-blue, their inner sides
tinged with yellow; claws black, that of the inner toe yellowish at the
base. The upper part of the head and the hind neck are light grey or
hoary, the fore part and sides of the head darker. The upper parts
are glossy black tinged with green anteriorly, and shaded with brown
behind. On the fore part of the back are two longitudinal bands of
transverse white bars, the feathers being tipped with that colour; the
scapulars, excepting the outer, are marked in the same manner with
transverse rows of rather large square spots. Most of the wing-
coverts have two roundish spots of white near the end. The quills are
blackish-brown, tinged with grey externally, paler on the inner webs;
the tail also blackish-brown. The fore neck, to the length of six and a
half inches, is purplish-black, ending angularly below, and with a
transverse interrupted band of linear white spots near the upper part;
beyond which the sides of the neck are blackish-brown, with several
longitudinal white streaks, formed by the edges of the feathers; on
the lower part of the neck a broad space is occupied by these
longitudinal, dusky, and white streaks the former of which gradually
become narrower. The lower parts are pure white, excepting a
longitudinal band on the sides under the wing, which is dusky.
Length to end of tail 29 inches, to end of wings 27 1/2, to end of
claws 33; extent of wings 39 1/2; wing from flexure 12 3/4; tail 2 3/4;
bill along the ridge 2 5 1/2/12, along the edge of lower mandible
3 4 1/2/12; tarsus 3 1/12; hind toe 8/12, its claw 2/12; second toe 3 2/12,
1/2 1/2
its claw 5 /12; third toe 3 8/12, its claw 5 5 /12; fourth toe 4 1/4, its
claw 4 1/2/12.

Adult Female. Plate CCCXLVI. Fig. 2.


The Female is smaller than the male, but is similarly coloured.
Young in Winter. Plate CCCXLVI. Fig. 3.
The texture of the plumage is less dense, the feathers on the neck
being more downy, and those of the back oblong and rounded. The
bill is light bluish-grey, dusky along the ridge; the iris brown; the feet
more dusky. The upper part of the head and the hind neck are dark
greyish-brown; the sides of the head greyish-white, minutely
streaked with brown. The upper parts have a reticulated or scaly
appearance, the feathers being brownish-black, with broad bluish-
grey margins; the rump dull brownish-grey. The primaries and their
coverts are brownish-black, the secondaries and tail-feathers dusky,
margined with grey. The fore part of the neck is greyish-white,
minutely and faintly dotted with brown, its sides below streaked with
the same; the lower parts, including the under surface of the wing,
pure white; the sides of the body and rump, with part of the lower
tail-coverts, dusky, edged with bluish-grey.
When in their first downy plumage, the young are of a uniform
brownish-black colour.
SMEW OR WHITE NUN.

Mergus Albellus, Linn.


PLATE CCCXLVIL. Male and Female.

The Smew is a bird of extremely rare occurrence in the United


States, insomuch that it must be considered merely as a transient or
accidental visitor. Indeed I have felt strong misgivings on reading
Wilson’s article on this species, and cannot but think that he is
mistaken when he states that it “is much more common on the coast
of New England than farther south,” and again “In the ponds of New
England, and some of the lakes in the State of New York, where the
Smew is frequently observed—.” Now, although I have made diligent
inquiry, not only in New England, but in every part of our country
where I thought it likely that the Smew might occur, I have not met
with any person well acquainted with birds of this family, who has
seen it. Wilson, in short, was in all probability misinformed, and it is
my opinion that his figure was made from a stuffed European
specimen which was then in Peale’s Museum in Philadelphia, and
that he had taken the Buffel-headed Duck, seen at a distance, for
this species, as I am aware has been the case with other individuals.
The only specimen procured by me was shot by myself on Lake
Barataria, not far from New Orleans, in the winter of 1819. It was an
adult female in fine plumage. How it had wandered so far south is an
enigma to me; but having found it, and made a drawing of it on the
spot, I have taken the liberty to add one of the other sex from an
equally fine specimen. After all, the Smew can scarcely be
considered as belonging to the American Fauna, any more than our
Fork-tailed Hawk can with propriety be called a denizen of England;
and in this I am supported by all the great navigators of our Arctic
Seas, such as Ross, Parry, and Franklin, none of whom, nor any
of their companions, ever met with a single individual of this beautiful
bird.

Mergus Albellus, Linn. Syst. Nat. vol. i. p. 209.—Lath. Ind. Ornith. vol. ii. p.
831.—Ch. Bonaparte, Synopsis of Birds of United States, p. 398.
Smew or White Nun, Mergus Albellus, Wils. Amer. Ornith. vol. viii. p. 126,
pl. 71, fig. 4. Male.
The Smew, or White Nun, Nuttall, Manual, vol. ii. p. 467.

Adult Male Plate CCCXLVII. Fig. 1.


Bill rather shorter than the head, straight, rather slender, a little
higher than broad at the base, tapering, somewhat cylindrical toward
the end. Upper mandible with the dorsal outline sloping gently and
slightly concave to the middle, then straight, at the tip declined, the
ridge rather broad and flat at the base, then convex, the sides
sloping at the base, convex toward the end, the edges serrate
beneath, with about forty slightly reversed, compressed, tapering,
tooth-like lamellæ, the unguis elliptical, much curved. Nasal groove
oblong, sub-basal, filled by a soft membrane; nostrils oblong,
submedial, direct, pervious. Lower mandible with the angle very
narrow and extended to the obovate, very convex unguis, the sides
rounded, with a long groove, the edges with about sixty
perpendicular sharp lamellæ.
Head of moderate size, oblong, compressed. Neck of moderate
length. Body full and depressed. Feet placed far behind, extremely
short; tibia bare for a quarter of an inch; tarsus extremely short,
much compressed, anteriorly covered with a series of very small
scutella, and another row on the lower half externally, the sides
reticulate. Hind toe very small, with an inferior free membrane;
anterior toes double the length of the tarsus; the second shorter than
the fourth, which is nearly as long as the third; all connected by
reticulated webs, of which the outer is deeply emarginate. Claws
short, considerably curved, compressed, acute, that of the middle
toe with a thin inner edge.
Plumage full, soft, and blended; feathers of the head and upper part
of the hind neck very slender, and elongated along the median line
into a narrow decurved crest; those of the shoulders obovate and
abrupt, of the rest of the upper parts ovate, of the lower elliptical.
Wings very short, narrow, curved, and pointed; primaries narrow,
tapering, the first scarcely longer than the second, the rest rapidly
graduated; secondaries short, narrow, rounded, the inner tapering to
an obtuse point. Tail short, graduated, of sixteen rather narrow,
tapering feathers.
Bill dark greyish-blue. Iris bright red. Feet livid blue, claws dusky.
The general colour of the plumage is pure white; a short band on
each side of the hind neck bordering the crest, duck-green; a broad
patch on the lore and below the eye, a narrow band across the lower
part of the hind neck, formed by single bars near the tips of the
feathers, the middle of the back in its whole length, a short
transverse bar under the fore edge of the wing, the anterior margin
of that organ to beyond the carpal joint, the outer edges of the
scapulars, the primary coverts, the secondary coverts, and the outer
secondary quills, excepting the tips of both, deep black. The quills
are also black, but of a less deep tint; the hind part of the back
becomes tinged with grey, and the rump and tail-feathers are dusky
grey. The sides of the body and rump are white, finely undulated with
blackish-grey.
Length to end of tail 17 1/2 inches, to end of claws 18 1/4, to end of
1/2
wings 15 1/2; extent of wings 27; bill along the ridge 1 3 /12, along
1/
the edge of lower mandible 1 7 2/12; wing from flexure 7 3/4; tail 3 1/2;
1/
tarsus 1 1 /12; first toe 1/2, its claw 2/12; second toe 1 1/2, its claw
2

4/ ,
12third toe 1 11/12, its claw 4 1/2/12; fourth toe 1 10/12, its claw 5/12.
Weight 1 lb. 8 oz.
Adult Female. Plate CCCXLVII. Fig. 2.
The Female is much smaller. The feathers of the hind part of the
head and neck are also elongated so as to form a crest. The bill, iris,
and feet, are coloured as in the male. All the lower parts are white,
excepting a broad band of light grey across the middle of the neck,
and a narrow portion of the sides, which are of a deeper tint. There is
a patch of brownish-black on the lore and beneath the eye; the upper
part of the head and half of the hind neck, are light reddish-brown;
the rest of the hind neck, and all the upper parts, bluish-grey, darker
behind, and in the middle of the back approaching to black. The
wings as in the male, that is black, with a large patch of white, and
two narrow transverse bands of the same; the tail dusky grey.
Length to end of tail 15 1/4 inches, to end of claws 16 1/2, to end of
wings 14 1/2; extent of wings 25. Weight 1 lb. 4 oz.
GADWALL DUCK.

Anas strepera, Linn.


PLATE CCCXLVIII. Male and Female.

I have met with this species along the whole of our Atlantic coast,
from Eastport in Maine to Texas. It is, however, more abundant in the
interior than in most of our maritime districts, and is particularly so on
the tributaries of the Ohio, Missouri, and Mississippi. In the early part
of autumn and late in spring many are found on the margins of our
great lakes. Yet the Gadwall has been represented as not plentiful in
the United States, probably on account of its being generally
dispersed, and not congregated in particular districts.
The Creoles of Louisiana name it “Violon,” on account of the
whistling sound of its wings. It arrives in the neighbourhood of New
Orleans and the mouths of the Mississippi along with the Widgeon,
and is fond of the company of the Red-head, to which it is about
equal as an article of food. The Gadwalls are usually seen in small
flocks, and during winter resort to the larger lakes and the pools in
the interior of the great marshes, adjoining the waters of the Gulf. In
that part of the country they feed on small fish, insects, and aquatic
grasses. Fewer of them are found in Massachusetts and the State of
New York than elsewhere, and this probably on account of these
districts being more elevated and less marshy than those farther
south. My friend Dr Bachman informs me that they are rather
plentiful in South Carolina, where they are considered good eating,
and where they arrive in the beginning of October, but are more
frequently met with at that season, and in early spring, than during
winter, when a single individual may sometimes be seen in a flock of
other ducks.
While we were in the Texas, in the latter part of April and the
beginning of May, we found the Gadwall quite abundant on all the
inland ponds and streams, as well as on the brackish pools and
inlets of the islands and shores of Galveston Bay. Many of them had
paired and separated from the other ducks; and I was assured that
this species breeds there, as does the Dusky Duck, the Mallard, the
Blue-winged Teal, the Widgeon, and the Shoveller, the young of all
these species being plentiful in the end of June and beginning of
July. I was satisfied as to the truth of the repeated assurances I had
received on this subject, by observing the manners of individuals of
all these species before my departure from that country. After a
continuance of rainy weather, Gadwalls are found in great numbers
on the vast prairies of Oppelousas and Attacapas, where I have
been told they continue until very late in spring, and some remain to
breed.
This species dives well on occasion, especially on being wounded.
At the appearance of danger, it rises on wing—whether from the
ground or from the water—at a single spring, in the manner of the
Mallard, and, like it also, ascends almost perpendicularly for several
yards, after which it moves off in a direct course with great celerity. I
have never seen it dive on seeing the flash of the gun; but when
approached it always swims to the opposite part of the pond, and,
when the danger increases, flies off. On being wounded, it
sometimes by diving makes its escape among the grass, where it
squats and remains concealed. It walks with ease, and prettily, often
making incursions upon the land, when the ponds are not
surrounded by trees, for the purpose of searching for food. It nibbles
the tender shoots and blades of grasses with apparent pleasure, and
will feed on beech-nuts, acorns, and seeds of all kinds of gramineæ,
as well as on tadpoles, small fishes, and leeches. After rain it alights
in the corn-fields, like the Mallard, and picks up the scattered grains
of maize. The common notes or cry of the female have a
considerable resemblance to those of the female Mallard; but the cry
of the male is weaker as in that species.
It is by no means shy in the Western Country, where I have often
found it associating with other species, which would leave the pond
before it. Near the sea, however, it is much more wary, and this no
doubt on account of the greater number of persons who there follow
shooting as a regular and profitable employment. From the following
note of my friend Dr Bachman, you may judge how easily this fine
species might be domesticated.
“In the year 1812 I saw in Dutchess County, in the State of New
York, at the house of a miller, a fine flock of ducks, to the number of
at least thirty, which, from their peculiar appearance, struck me as
differing from any I had before seen among the different varieties of
the tame Duck. On inquiry, I was informed that three years before, a
pair of these ducks had been captured in the mill pond, whether in a
trap, or by being wounded, I cannot recollect. They were kept in the
poultry-yard, and, it was said, were easily tamed. One joint of the
wing was taken off, to prevent their flying away. In the following
spring they were suffered to go into the pond, and they returned daily
to the house to be fed. They built their nest on the edge of the pond,
and reared a large brood. The young were perfectly reconciled to
domestication, and made no attempts, even at the migratory season,
to fly away, although their wings were perfect. In the following
season they produced large broods. The family of the miller used
them occasionally as food, and considered them equal in flavour to
the common duck, and more easily raised. The old males were more
beautiful than any that I have examined since; and as yet
domestication had produced no variety in their plumage.”
The migration of this species extends to the Fur Countries, where it
is said to breed. The description of a male killed on the
Saskatchewan River, on the 22d of May 1827, is given in the Fauna
Boreali-Americana; and I have a fine male procured by Dr
Townsend on the Columbia River.

Anas strepera, Linn. Syst. Nat. vol. i. p. 200.—Lath. Ind. Ornith. vol. ii. p.
859.—Ch. Bonaparte, Synopsis of Birds of United States, p. 383.
Gadwall, Anas strepera, Wils. Amer. Ornith. vol. viii. p. 120, pl. 71, fig. 1.—
Richards. and Swains. Fauna Bor.-Amer. vol. ii. p. 440.
Gadwall or Grey, Nuttall, Manual, vol. ii. p. 383.

Adult Male. Plate CCCXLVIII. Fig. 1.


Bill nearly as long as the head, deeper than broad at the base,
depressed towards the end, the sides parallel, the tip rounded.
Upper mandible with the frontal angles short and obtuse, the dorsal
line at first sloping, then slightly concave and direct, the ridge broad
and flat at the base, then broadly convex, the edges soft, with about
fifty internal lamellæ, the unguis roundish, curved abruptly at the
end. Nostrils sub-basal, lateral, rather small, oblong, pervious. Lower
mandible flattened, its angle very long and narrow, the dorsal line
very short, slightly convex, the edges soft, with about sixty lamellæ.
Head of moderate size, oblong, compressed. Neck rather long,
slender. Body elongated, slightly depressed. Feet very short; tibia
bare for about a quarter of an inch; tarsus very short, compressed,
anteriorly with two series of scutella, the outer shorter, the rest
covered with reticulated angular scales; toes obliquely scutellate
above; first very small, free, with a narrow membrane beneath; third
longest, fourth considerably shorter, second shorter than fourth, their
connecting webs entire, on the edge crenate; the second or inner toe
with a membranous margin. Claws small, slightly arched,
compressed, rather acute, the hind one very small and more curved,
that of the middle toe with an inner sharp edge.
Plumage dense, soft, blended. Feathers of the head short, of the
occiput and nape a little elongated, of the lower parts glossy with the
extremities of the filaments stiffish. Wings rather long, little curved,
pointed; the first quill longest, the rest rapidly graduated; secondaries
very broad, but pointed, the inner much elongated, and tapering to a
point. The tips of the filaments of the outer web of the first primary
are separated and curved a little forwards. Tail short, rounded, of
sixteen strong pointed feathers, of which the middle pair project
considerably.
Bill bluish-black. Iris reddish hazel. Feet dull orange-yellow, claws
brownish-black, webs dusky. Head light yellowish-red, the upper part
and nape much darker and barred with dusky; the rest dotted with
the same. The lower part of the neck, the sides of the body, the fore
part of the back, and the outer scapulars, undulated with dusky, and
yellowish-white, the bands much larger and semicircular on the fore
part of the neck and breast; the latter white, the abdomen faintly and
minutely undulated with brownish-grey; the elongated scapulars
brownish-grey, broadly margined with brownish-red; the hind part of
the back brownish-black; the rump all round, and the upper and
lower tail-coverts, bluish-black. The anterior smaller wing-coverts are
light grey, undulated with dusky, the middle coverts of a deep rich
chestnut-red; primary coverts brownish-grey, outer secondary
coverts darker and tinged with chestnut, the rest black, excepting the
inner, which are grey. Primaries and inner elongated secondaries
brownish-grey, of which colour also are the inner webs of the rest,
part of the outer webs of five of the outer black, and their terminal
margins white, of which colour are the whole outer webs of the three
next to the inner elongated quills. Tail brownish-grey, the feathers
margined with paler.
Length to end of tail 21 3/4 inches, to end of wings 19, to end of
claws 23 1/4; extent of wings 35; bill along the ridge 1 3/4, along the
edge of lower mandible 1 7/8; wing from flexure 11; tail 4 3/8; tarsus
1 1/2; hind toe and claw 1/2; second toe 1 5/8, its claw 4/12; third toe
1 7/8, its claw 4/12; outer toe 1 7 1/2/12, its claw 2/12. Weight 1 lb. 10 oz.

Adult Female. Plate CCCXLVIII. Fig. 2.


The female is considerably smaller. Bill dusky along the ridge, dull
yellowish-orange on the sides. Iris hazel. Feet of a fainter tint than in
the male. Upper part of head brownish-black, the feathers edged
with light reddish-brown; a streak over the eye, the cheeks, the
upper part of the neck all round, light yellowish-red tinged with grey,
and marked with small longitudinal dusky streaks, which are fainter
on the throat, that part being greyish-white; the rest of the neck, the
sides, all the upper parts and the lower rump feathers brownish-
black broadly margined with yellowish-red. Wing-coverts brownish-
grey, edged with paler; the wing otherwise as in the male, but the
speculum fainter. Tail-feathers, and their coverts dusky, laterally
obliquely indented with pale brownish-red, and margined with
reddish-white.
Length to end of tail 19 1/4 inches, to end of wings 18 3/4, to end of
claws 19 1/2; extent of wings 31; wing from flexure 8 1/4; tail 3 3/4;
tarsus 1 4 1/2/12; middle toe 1 9 1/2/12, its claw 4/12.

In a male, the roof of the mouth is deeply concave, with a prominent


median ridge, and oblique grooves toward the end. The tongue is 1
inch 10 twelfths long, fleshy, with a deep longitudinal groove, two
lateral series of filaments, and a thin broadly rounded tip, as in other
ducks. The œsophagus, a, b, is 10 1/2 inches long, 5 twelfths in
diameter for about four inches, then enlarged to 10 twelfths, and
again contracted as it enters the thorax. The proventriculus, b b, is 1
inch and two twelfths long, its greatest diameter 8 twelfths. The
stomach, c d e, is a very large and powerful gizzard, of an elliptical
form, compressed, 1 inch and 9 twelfths long, 2 inches in its greatest
breadth, or in the direction of the lateral muscles, of which the right,
c, is 10 twelfths thick, the left, d, 9 twelfths. The epithelium is thick
and rugous; much thickened and forming two roundish, flat or slightly
concave grinding surfaces, opposite the muscles. The intestine, e f
g, is 6 feet 10 inches long, wide, its diameter for 2 feet being 4 1/2
twelfths, towards the rectum enlarging to 6 twelfths. It forms first a
very long duodenal curve, c e f g, and is then convoluted or coiled in
numerous folds. The rectum is 5 1/4 inches long; the cœca 11 inches,
their greatest diameter 6 twelfths, for 2 inches at the commencement
2 twelfths, towards the end 2 1/2 twelfths, their extremity rounded.
The trachea, h, is 7 1/2 inches long; its diameter at the upper part 4
twelfths, gradually diminishing to 3 1/2 twelfths; it then enlarges to 5
twelfths, and contracts to 3 1/2 twelfths at the commencement of the
dilatation of the inferior larynx, which is extremely similar to that of
the Widgeon, but larger; there being an enlargement, i, formed by a
number of the lower rings united, and to the left side a rounded bony
tympanum j; the greatest transverse diameter of this part, from i to j,
is 1 inch 1 twelfth. The bronchi, k k, are of moderate size, covered
with a dense layer of adipose matter.
LEAST WATER RAIL.

Rallus jamaicensis, Gmel.


PLATE CCCXLIX. Male and Young.

My knowledge of this pretty little species is altogether derived from


Titian Peale, Esq., of Philadelphia, by whom, in October 1836, I
was favoured with the following letter:—
“I herewith send you the ‘Little Rail’ of which we were speaking
yesterday, and the letter of Dr Rowan which relates to it. The young
died soon after I received them, but the old one lived with me until
the 26th of July (four days after its capture), evincing considerable
anxiety for the young, as long as they lived. Both young and old
partook sparingly of Indian meal and water, or bread and water, and
soon became quite at home, and probably might have been
domesticated, had they been properly accommodated.
“The most remarkable part of the history of this individual is, that
after its death we should have discovered in dissection that it was a
male, rendering it singularly curious that he should have suffered
himself to be captured by hand while in defence of the young brood.
“There is now in the Museum a specimen of this species, which has
been in the collection for about thirty years, said to have been caught
in the vicinity of the city. It stands labelled ‘Little Rail, Rallus minutus,
Turton’s Linn;’ but the authenticity of the specimen has always been
disputed by Bonaparte and others, because none else had been
found; and the author just named expressed a belief that it was an
immature specimen of Rallus (Crex) Porzana of Europe.
“I regret that I should have mislaid the measurements of the
specimen when recent, if any were taken, and cannot lay my hands
on them, or any thing more than the above notes. Respectfully
yours, &c.

Titian R. Peale.”
Inclosed in Mr Peale’s letter was the following note from Dr Rowan
“to the Messrs Peales.”
“On Saturday last I wrote to you of the Rail Bird breeding near this
place. I then described one that I caught last summer, which was
unlike the Rail in the fall season, and I presumed that all in the wet
ground were the same, but this day my men mowing around the
pond started up two of the usual kind. The hen flew a few rods, and
then flew back to her young in an instant, when they caught her
together with her four young, which I herewith send you. Many more
can be caught. I have seen them in our meadow every month of the
year, but they never make a great noise except when very fat on the
wild oat’s seed. From the above you will conclude that they do not
migrate to the south, but breed here. Respectfully,

Thomas Rowan.”

Rallus jamaicensis, Brisson Sup. p. 140.—Gmel. Syst. Nat. vol. ii. p. 718.—
Lath. Ind. Ornith. vol. ii. p. 761.

Adult Male. Plate CCCXLIX. Fig. 1.


Bill shorter than the head, rather stout, compressed, tapering. Upper
mandible with the dorsal line nearly straight, being slightly convex
toward the end, the ridge narrow and convex in its whole length, the
sides convex towards the end, the edges sharp, the tip rather acute.

You might also like