OpenGL Build high performance graphics Learning
Path 1st Edition Muhammad Mobeen Movania pdf
download
https://ebookmeta.com/product/opengl-build-high-performance-
graphics-learning-path-1st-edition-muhammad-mobeen-movania/
Download more ebook from https://ebookmeta.com
We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!
OpenGL to OpenGL ES ■Navigating Graphics Transitions
Kameron Hussain■ Frahaan Hussain
https://ebookmeta.com/product/opengl-to-opengl-
es-%ef%bc%9anavigating-graphics-transitions-kameron-
hussain%ef%bc%8c-frahaan-hussain/
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/
OpenGL Foundations Taking Your First Steps in Graphics
Programming Kameron Hussain
https://ebookmeta.com/product/opengl-foundations-taking-your-
first-steps-in-graphics-programming-kameron-hussain/
Popular Culture Introductory Perspectives 4th Edition
Marcel Danesi
https://ebookmeta.com/product/popular-culture-introductory-
perspectives-4th-edition-marcel-danesi/
The Clockwork Dragon Section 13 Book 3 Hannibal James R
https://ebookmeta.com/product/the-clockwork-dragon-
section-13-book-3-hannibal-james-r/
Rebel Wolf s Forbidden Mate 1st Edition Chloe Graves
https://ebookmeta.com/product/rebel-wolf-s-forbidden-mate-1st-
edition-chloe-graves/
Spatial and Temporal Distribution of Dengue A Case
Study of Lahore 1st Edition Anam Khalid
https://ebookmeta.com/product/spatial-and-temporal-distribution-
of-dengue-a-case-study-of-lahore-1st-edition-anam-khalid/
The Final FFICM Structured Oral Examination Study Guide
(MasterPass) 1st Edition Eryl Davies
https://ebookmeta.com/product/the-final-fficm-structured-oral-
examination-study-guide-masterpass-1st-edition-eryl-davies/
Building Construction Illustrated 6th Edition Francis D
K Ching
https://ebookmeta.com/product/building-construction-
illustrated-6th-edition-francis-d-k-ching/
Ultra Rare Porsche 911 Book 4th Edition Evan Fischer
https://ebookmeta.com/product/ultra-rare-porsche-911-book-4th-
edition-evan-fischer/
OpenGL – Build high
performance graphics
Assimilate the ideas shared in the course
to utilize the power of OpenGL for performing
a wide variety of tasks
A course in three modules
BIRMINGHAM - MUMBAI
OpenGL – Build high performance graphics
Copyright © 2017 Packt Publishing
All rights reserved. No part of this course may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this course to ensure the accuracy
of the information presented. However, the information contained in this course
is sold without warranty, either express or implied. Neither the authors, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this course.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this course by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
Published on: May 2017
Production reference: 1050517
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78829-672-4
www.packtpub.com
Credits
Authors Content Development Editor
Muhammad Mobeen Movania Vikas Tiwari
David Wolff
Raymond C. H. Lo Graphics
Abhinash Sahu
William C. Y. Lo
Production Coordinator
Reviewers
Shantanu N. Zagade
Bastien Berthe
Dimitrios Christopoulos
Oscar Ripolles Mateu
Bartłomiej Filipek
Thomas Le Guerroué-Drévillon
Muhammad Mobeen Movania
Dario Scarpa
Javed Rabbani Shah
Samar Agrawal
Sebastian Eichelbaum
Oscar Ripolles
Qing Zhang
Preface
OpenGL is a fully functional, cross-platform API widely adopted across the industry
for 2D and 3D graphics development. It is mainly used for game development and
applications, but is equally popular in a vast variety of additional sectors. This
practical course will help you gain proficiency with OpenGL and build compelling
graphics for your games and applications.
What this learning path covers
Module 1, OpenGL Development Cookbook - This is your go to guide to learn graphical
programming techniques and implement 3D animations with OpenGL. This straight-
talking cookbook is perfect for intermediate C++ programmers who want to exploit
the full potential of OpenGL. Full of practical techniques for implementing amazing
computer graphics and visualizations, using OpenGL. Crammed full of useful
recipes, OpenGL Development Cookbook will help you exploit OpenGL to its
full potential.
Module 2, OpenGL 4.0 Shading Language Cookbook, Second Edition – With Version 4,
the language has been further refined to provide programmers with greater power
and flexibility, with new stages such as tessellation and compute. OpenGL Shading
Language 4 Cookbook is a practical guide that takes you from the fundamentals of
programming with modern GLSL and OpenGL, through to advanced techniques.
The recipes build upon each other and take you quickly from novice to advanced
level code.
[i]
Preface
Module 3, OpenGL Data Visualization Cookbook – From a mobile device to a
sophisticated high-performance computing cluster, OpenGL libraries provide
developers with an easy-to-use interface to create stunning visuals in 3D in real time
for a wide range of interactive applications. This is an easy-to-follow, comprehensive
Cookbook showing readers how to create a variety of real-time, interactive data
visualization tools. Each topic is explained in a step-by-step format. A range of hot
topics is included, including stereoscopic 3D rendering and data visualization on
mobile/wearable platforms. By the end of this guide, you will be equipped with the
essential skills to develop a wide range of impressive OpenGL-based applications
for your unique data visualization needs, on platforms ranging from conventional
computers to the latest mobile/wearable devices.
What you need for this learning path
Module 1:
The module assumes that the reader has basic knowledge of using the OpenGL
API. The example code distributed with this module contains Visual Studio 2010
Professional version project files. In order to build the source code, you will need
freeglut, GLEW, GLM, and SOIL libraries. The code has been tested on a Windows 7
platform with an NVIDIA graphics card and the following versions of libraries:
• freeglut v2.8.0 (latest version available from:
http://freeglut.sourceforge.net)
• GLEW v1.9.0 (latest version available from:
http://glew.sourceforge.net)
• GLM v0.9.4.0 (latest version available from: http://glm.g-truc.net)
• SOIL (latest version available from: http://www.lonesock.net/soil.html)
We recommend using the latest version of these libraries. The code should compile
and build fine with the latest libraries.
Module 2:
The recipes in this module use some of the latest and greatest features in OpenGL
4.x. Therefore, in order to implement them, you’ll need graphics hardware (graphics
card or onboard GPU) and drivers that support at least OpenGL 4.3. If you’re
unsure about what version of OpenGL your setup can support, there are a number
of utilities available for determining this information. One option is GLview from
Realtech VR, available at: http://www.realtech-vr.com/glview/. If you’re
running Windows or Linux, drivers are readily available for most modern hardware.
However, if you’re using MacOS X, unfortunately, you may need to wait. As of this
writing, the latest version of MacOS X (10.9 Mavericks) only supports OpenGL 4.1.
[ ii ]
Preface
Once you’ve verified that you have the required OpenGL drivers, you’ll also need
the following:
• A C++ compiler. On Linux, the GNU Compiler Collection (gcc, g++, and so
on) may already be available, and if not, it should be available through your
distribution’s package manager. On Windows, Microsoft Visual Studio will
work fine, but if you don’t have a copy, then the MinGW compiler (available
from http://mingw.org/) is a good option.
• The GLFW library Version 3.0 or later, available from http://www.glfw.
org/. This library provides OpenGL context creation, window support, and
support for user input events.
• The GLM library Version 0.9.4 or later, available from http://glm.g-truc.
net/. This provides mathematics support with classes for matrices, vectors,
common transformations, noise functions, and much more.
Module 3:
This module supports a wide range of platforms and open source libraries, ranging
from Windows, Mac OS X, or Linux-based desktop applications to portable
Android-based mobile applications. You will need a basic understanding of C/C++
programming and background in basic linear algebra for geometric models.
The following are the requirements for chapters 1 to 3:
• OpenGL version: 2.0 or higher (easy to test on legacy graphics hardware).
• Platforms: Windows, Mac OS X, or Linux.
• Libraries: GLFW for OpenGL Windows/context management and handling
user inputs. No additional libraries are needed, which makes it very easy to
integrate into existing projects.
• Development tools: Windows Visual Studio or Xcode, CMake, and gcc.
• The following are the requirements for chapters 4 to 6:
• OpenGL version: 3.2 or higher.
• Platforms: Windows, Mac OS X, or Linux.
• Libraries: Assimp for 3D model loading, SOIL for image and texture loading,
GLEW for runtime OpenGL extension support, GLM for matrix operations,
and OpenCV for image processing.
• Development tools: Windows Visual Studio or Xcode, CMake, and gcc.
• The following are the requirements for chapters 7 to 9:
• OpenGL version: OpenGL ES 3.0.
[ iii ]
Preface
• Platforms: Linux or Mac OS X for development, and Android OS 4.3 and
higher (API 18 and higher) for deployment.
• Libraries: OpenCV for Android and GLM.
• Development tools: Android SDK, Android NDK, and Apache Ant in Mac
OS X or Linux.
• For more information, keep in mind that the code in this module was
built and tested with the following libraries and development tools in all
supported platforms:
• OpenCV 2.4.9 (http://opencv.org/downloads.html)
• OpenCV 3.0.0 for Android (http://opencv.org/downloads.html) SOIL
(http://www.lonesock.net/soil.html)
• GLEW 1.12.0 (http://glew.sourceforge.net/)
• GLFW 3.0.4 (http://www.glfw.org/download.html)
• GLM 0.9.5.4 (http://glm.g-truc.net/0.9.5/index.html)
• Assimp 3.0 (http://assimp.sourceforge.net/main_downloads.html)
• Android SDK r24.3.3 (https://developer.android.com/sdk/index.html)
• Android NDK r10e (https://developer.android.com/ndk/downloads/
index.html)
• Windows Visual Studio 2013 (https://www.visualstudio.com/en-us/
downloads/download-visual-studio-vs.aspx)
• CMake 3.2.1 (http://www.cmake.org/download/)
Who this learning path is for
The course is appropriate for anyone who wants to develop the skills and techniques
essential for working with OpenGL to develop compelling 2D and 3D graphics.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this course—what you liked or disliked. Reader feedback is important for us as it
helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail [email protected], and mention
the course’s title in the subject of your message.
[ iv ]
Preface
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt course, we have a number of things to
help you to get the most from your purchase.
Downloading the example code
You can download the example code files for this course from your account at
http://www.packtpub.com. If you purchased this course elsewhere, you can visit
http://www.packtpub.com/support and register to have the files e-mailed directly
to you.
You can download the code files by following these steps:
1. Log in or register to our website using your e-mail address and password.
2. Hover the mouse pointer on the SUPPORT tab at the top.
3. Click on Code Downloads & Errata.
4. Enter the name of the course in the Search box.
5. Select the course for which you’re looking to download the code files.
6. Choose from the drop-down menu where you purchased this course from.
7. Click on Code Download.
You can also download the code files by clicking on the Code Files button on the
course’s webpage at the Packt Publishing website. This page can be accessed by
entering the course’s name in the Search box. Please note that you need to be logged
in to your Packt account.
Once the file is downloaded, please make sure that you unzip or extract the folder
using the latest version of:
• WinRAR / 7-Zip for Windows
• Zipeg / iZip / UnRarX for Mac
• 7-Zip / PeaZip for Linux
The code bundle for the course is also hosted on GitHub at https://github.com/
PacktPublishing/OpenGL-Build-High-Performance-Graphics. We also have
other code bundles from our rich catalog of books, videos, and courses available at
https://github.com/PacktPublishing/. Check them out!
[v]
Preface
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our courses—maybe a mistake in the text
or the code—we would be grateful if you could report this to us. By doing so, you
can save other readers from frustration and help us improve subsequent versions
of this course. If you find any errata, please report them by visiting http://www.
packtpub.com/submit-errata, selecting your course, clicking on the Errata
Submission Form link, and entering the details of your errata. Once your errata are
verified, your submission will be accepted and the errata will be uploaded to our
website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/
content/support and enter the name of the course in the search field. The required
information will appear under the Errata section.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all
media. At Packt, we take the protection of our copyright and licenses very seriously.
If you come across any illegal copies of our works in any form on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.
Please contact us at [email protected] with a link to the suspected
pirated material.
We appreciate your help in protecting our authors and our ability to bring you
valuable content.
Questions
If you have a problem with any aspect of this course, you can contact us at
[email protected], and we will do our best to address the problem.
[ vi ]
Module 1
OpenGL Development Cookbook
Over 40 recipes to help you learn, understand, and implement
modern OpenGL in your applications
Module 1: OpenGL Development Cookbook
Chapter 1: Introduction to Modern OpenGL 7
Introduction 7
Setting up the OpenGL v3.3 core profile on Visual Studio 2010 using
the GLEW and freeglut libraries 8
Designing a GLSL shader class 16
Rendering a simple colored triangle using shaders 19
Doing a ripple mesh deformer using the vertex shader 28
Dynamically subdividing a plane using the geometry shader 37
Dynamically subdividing a plane using the geometry shader with
instanced rendering 45
Drawing a 2D image in a window using the fragment shader and
the SOIL image loading library 48
Chapter 2: 3D Viewing and Object Picking 55
Introduction 55
Implementing a vector-based camera with FPS style input support 56
Implementing the free camera 59
Implementing the target camera 63
Implementing view frustum culling 66
Implementing object picking using the depth buffer 72
Implementing object picking using color 74
Implementing object picking using scene intersection queries 76
Chapter 3: Offscreen Rendering and Environment Mapping 81
Introduction 81
Implementing the twirl filter using fragment shader 82
Rendering a skybox using the static cube mapping 85
Implementing a mirror with render-to-texture using FBO 89
Table of Contents
Rendering a reflective object using dynamic cube mapping 93
Implementing area filtering (sharpening/blurring/embossing)
on an image using convolution 98
Implementing the glow effect 101
Chapter 4: Lights and Shadows 107
Introduction 107
Implementing per-vertex and per-fragment point lighting 108
Implementing per-fragment directional light 114
Implementing per-fragment point light with attenuation 117
Implementing per-fragment spot light 120
Implementing shadow mapping with FBO 122
Implemeting shadow mapping with percentage closer filtering (PCF) 128
Implementing variance shadow mapping 132
Chapter 5: Mesh Model Formats and Particle Systems 141
Introduction 141
Implementing terrains using the height map 142
Implementing 3ds model loading using separate buffers 146
Implementing OBJ model loading using interleaved buffers 157
Implementing EZMesh model loading 163
Implementing simple particle system 171
Chapter 6: GPU-based Alpha Blending and Global Illumination 181
Introduction 181
Implementing order-independent transparency using front-to-back peeling 182
Implementing order-independent transparency using dual depth peeling 189
Implementing screen space ambient occlusion (SSAO) 195
Implementing global illumination using spherical harmonics lighting 202
Implementing GPU-based ray tracing 207
Implementing GPU-based path tracing 213
Chapter 7: GPU-based Volume Rendering Techniques 219
Introduction 219
Implementing volume rendering using 3D texture slicing 220
Implementing volume rendering using single-pass GPU ray casting 228
Implementing pseudo-isosurface rendering in single-pass GPU ray casting 232
Implementing volume rendering using splatting 237
Implementing transfer function for volume classification 244
Implementing polygonal isosurface extraction using
the Marching Tetrahedra algorithm 248
Implementing volumetric lighting using the half-angle slicing 254
ii
Another Random Scribd Document
with Unrelated Content
They touched down and opened the hatches. Already a crowd of
Malans had gathered. A few artists had set up their easels and were
busy painting the freighter, not because it was lovely, but because it
was Terran, which was better.
A Malan stepped forward, grinning. "Well," he asked, "what do you
think of it?"
"Of what?"
"Our war, of course. You must have noticed!"
"Oh, yes, we noticed," Beliakoff said.
"A real intercontinental war complete with ideological differences,"
the man stated proudly. "Just like the civilized planets have. You
must admit it's Earthlike."
"Exceedingly Earthlike," Kelly said. "Now take us to whoever's in
charge—quick!"
The conference with Nob at the Imperial Palace began well. The
Prime Minister was overjoyed that real Earthmen had come to
witness their war. He knew very well that, by Earth standards, it was
a pretty small war. A beginner's war, really. But they were trying.
Some day, with more know-how, with better equipment, they would
be able to produce a war that would match anyone's.
"We were hampered from the start," Nob apologized, "by not
knowing how to produce atomic fission."
"That must have been confining," Kelly said, and Beliakoff winced.
"It was. Dynamite and nitroglycerin just don't have the same
grandeur and finality. The scale of demolition seems insignificant.
But if you will come with me, gentlemen, I have something here
which may interest you."
Nob ushered the Earthmen ahead of him so he could copy their
loose-jointed, rolling walk.
"Here!" he said, darting ahead and opening a door. "Behold!"
The Earthmen saw, upon an ivory pedestal, a small model of an
atomic bomb.
"We worked until we mastered it at last," Nob said proudly. "With
any luck, we'll be in production within the month and using them
within the year. Now I think I can safely say that Mala has come of
age!"
Beliakoff said, "No."
"No, what?"
"No atom bombs."
"But it's Earthlike to use atomic bombs. Why—"
"This war has to end at once," Kelly said.
"You're joking!" protested Nob, looking intently at the Earthmen. But
he saw at once that they were deadly serious. He groaned and sat
down.
Nob was faced with a moral dilemma of fearful proportions. On the
one hand, war was a typical Terran institution, an extremely
important one, an institution clearly worthy of emulation by the
people of Mala. But on the other hand, this Terran institution was
being refuted, denied, in fact, by two typical Terrans.
The problem was insoluble for him. And Nob remembered that,
when an ultimate crisis is at hand, that is the moment for the
supreme authority to step in.
"We must discuss this with the Empress," he said.
He led them to Jusa's chambers, knocked and opened the door. Half
a dozen vases shattered around them.
"On your knees, pigs!" Jusa shrilled. "You, Nob, have you brought
the diamonds?"
"I knew I forgot something."
"Forgot them! Then how dare you show your face?" Jusa stamped
her small foot. "And these peasants—who are they? I've a good
mind to lock them up, especially that grinning red-headed ape."
Kelly's grin became a trifle strained.
"These are Earthmen, Your Majesty," Nob said. "Genuine Earthmen!"
"Really?" breathed Jusa.
"Really," said Nob.
"Oh, golly," Jusa said, losing all her painfully acquired imperial pose
and becoming a frightened, albeit lovely, young girl.
"Your Majesty—" Beliakoff began.
"Just call me Jusa. My gosh! Real Earthmen! I never met a real
Earthman before. I wish you had let me know in advance. My hair—"
"Is beautiful, just like yourself," Kelly said.
"I'm so glad. I think your hair is beautiful, too."
Kelly turned brick-red. "You're not supposed to say that, you know."
"I didn't know," Jusa said. "But I'm willing to learn. What should I
have—"
"Excuse me," Beliakoff broke in sourly. "Your Majesty, we've come to
ask you to stop the war."
"You don't mean it!" Jusa turned bewilderedly to Kelly.
"Have to do it, honey," Kelly said softly. "You folks just aren't ready
for a war yet."
Jusa's eyes flashed and she began to regain a little of her imperial
pose. "But of course we are! Look at what we've done. Go over our
battlefields, look at our cities, interrogate our refugees. You'll find
that everything has been done in strict accordance with the rules.
We're as ready for war as anyone!"
"I'm sorry, you'll have to stop it," Beliakoff said, and Kelly nodded his
agreement.
Jusa gave Nob a beseeching look, but the Prime Minister averted his
eyes. The dilemma was there again, enormous, insurmountable, and
squarely on Jusa's shoulders. To stop the war now would be
Unearthlike; to refuse the Earthmen was unthinkable.
"I just don't know," Jusa said. She looked at Kelly, who wore the
guilty expression of a man caught murdering a fawn. Then she burst
into tears and collapsed on a couch.
Nob and the Earthmen looked at each other, made several helpless
gestures, and left.
"What now?" Beliakoff asked, in the corridor. "Do you think she'll
stop the war?"
Nob shrugged his shoulders. "Who knows? It's a problem without a
solution."
"But she has to make up her mind," Kelly said. "That's one of the
duties of authority."
"The Empress is aware of that. And she will make up her mind,
though it could take a year or more. Unless she fails completely
under the strain."
"Poor kid," Kelly said. "She needs a man to help her out."
"Indeed she does," Nob agreed hastily. "A strong man, a wise man,
a man who could guide her and be as adviser and husband to her."
Kelly blinked, then laughed nervously. "Don't look at me! I mean
she's a cute kid, nice girl, make some man a wonderful wife, but I'm
not the marrying kind, you know what I mean?"
"Johnny," said Beliakoff, "I'd like to have a serious talk with you."
Nob led them to a vacant room and left discreetly.
"I won't do it!" Kelly declared bluntly.
"You have to," Beliakoff said. "You got us into this mess. Now you
can marry us out."
"No!"
"She'd make a wonderful wife," Beliakoff quoted Kelly's words back
at him. "Docile, pretty, but spirited. What more could you ask?"
"Freedom of choice," Kelly said grimly.
"That's for adolescents."
"Speaking."
"She'll never be able to make up her mind to stop the war unless
you marry her. Until the war ends, that interdictory ship is going to
sit in orbit, waiting for us. You haven't anything to lose," Beliakoff
added.
"I haven't?"
"Not a thing. It's a big galaxy and our freighter is always waiting."
"That's true...." Kelly admitted.
Ten minutes later, Beliakoff dragged him into the corridor. They were
joined by Nob, who ushered them back to the Empress's chambers.
"It's okay by me if it's okay by you, kid," Kelly blurted out, in a tone
that made Beliakoff shudder and made Nob smile in outright hero-
worship.
"What is all right?" Jusa asked.
"Marriage," Kelly said. "What d'ya say?"
Jusa studied his face for several seconds. "But do you love me?"
"Give it time, kid! Give it time!"
Jusa must have seen something in his expression, something behind
the embarrassment and anger. Very softly she said, "I will be most
happy to marry you."
It was a double-ring ceremony and authentically Terran. Beliakoff
produced a Bible from the freighter and the ancient words of the
Earth ceremony were read. When it was over, Kelly, grinning,
perspiring, nervously rubbing his hands together, turned to his bride.
"Now stop the war, honey."
"Yes, dear," Jusa said dutifully. She heaved a great sigh.
"What's wrong?" Kelly asked.
"I just tremble to think of our cities being bombed out of existence
and us not able to do anything about it because we've stopped
fighting."
"What are you talking about? If we stop fighting—"
"They won't!" she said. "Why should they? It's Earthlike to continue
conquering, and if we quit fighting, there'll be nothing to stop them
from conquering us completely."
"Nob!" Kelly shouted. "Igor! What can we do about this?"
Nob said, "There would appear to be only one certain solution. I can
arrange a meeting for you—" he turned to Beliakoff—"with Lanvi, the
President of the Allies."
"What would I say to him?" asked Beliakoff.
"To her," Nob corrected. "You can say, I suppose, the same sort of
thing your friend said."
Beliakoff, ashy pale, started to back away. Kelly caught him in one
meaty fist. "Okay, Mr. Fixer. Your duty is plain. Marry us out of
trouble."
"But I've got a girl friend in Minsk—"
"She forgot you years ago. Stop squirming, buddy."
"What does she look like?" Beliakoff queried in apprehension.
"Very pretty," Nob said.
During the double-ring ceremony, Beliakoff peered at his bride with
cautious approval. Lanvi was indeed a pretty girl and she seemed to
possess the Malan virtues of obedience, patience and fire.
As soon as the final words were spoken, the war was declared
officially over. Peace, an authentic Earth custom, was proclaimed.
"Now the real work begins," Beliakoff said. "First, we'll need a list of
the casualties."
"The what?" Nob asked.
"Casualties."
"I'm not sure I understand," said the Prime Minister.
"Casualties! The number of people killed in the warfare."
"Now wait a moment," Nob said, his voice trembling. "Do I
understand you correctly? Are you trying to tell me that civilized
people kill people in their wars? Do you mean that they leave people
in the cities they bomb?"
Kelly looked at Beliakoff. Beliakoff looked at Kelly.
"Lord, Lord," murmured Kelly.
Beliakoff merely gulped.
"Is it possible?" asked Nob. "Do civilized people really—"
"Of course not," said Beliakoff.
"Never," Kelly said.
Nob pursed his lips. "I've been wanting to ask a real authority, a
genuine Earthman, some questions on the subject. Our texts were
by no means complete and some parts we couldn't understand at
all. Like the matter of determining victories. That's something we
couldn't figure out. We decided you must use a complicated system
of umpires. It was too much for us, so we built a bunker in no man's
land and put a man from each side in it. They tossed coins to
determine whose turn it was. The winning side would bomb an
enemy city. After the occupants had been evacuated, of course."
"Of course," said Beliakoff.
"It worked out rather well with the coins," Nob said. "Law of
averages, in fact."
"Substantially our system," said Kelly.
"Just the way we do it," Beliakoff added.
"A few more questions, if you please," Nob said. "Jusa, would you
bring in the big War Encyclopedia?"
Jusa and Lanvi had been gossiping on the other side of the room.
They hurried out and returned with the great book.
"Now here," Nob said, opening the volume, "it seems to imply—"
"Wait," Beliakoff broke in. He took the book from Nob's hands and
flipped through it rapidly, then turned to Kelly. In a whisper, he said
in Propendium, "It looks as though Kyne blotted out all references to
killing."
"Sure!" exclaimed Kelly, brightening. "I told you he was a
hemophiliac—a bleeder. Naturally, he'd cut out every single mention
of bloodshed!"
"This point—" Nob began.
"Later," Beliakoff said. "Right now, we'd like to get a few articles
from our spaceship." He winked at Kelly, who winked back. "It won't
take a moment and then we'll be only too happy to—"
"Oh, dear," said Nob. "You mean you wanted the spaceship?"
"What?"
"Well, I assumed that you'd have no further use for it. Metal is hard
to get nowadays and it seemed only proper to erect heroic statues
to both of you, the men who brought the institution of peace to
Mala. Did I do something wrong?"
"Not at all, not at all," Kelly said. "Oh, not at all. Perfectly delighted.
Not at—"
"Johnny!" said Beliakoff.
"Sorry," Kelly apologized, a broken man.
The brides stepped forward to claim their husbands.
Peace and prosperity came to Mala, under the deft guidance of their
Terran leaders. In time, spaceships arrived and departed, but neither
man showed any particular desire to board one, for their wives—
docile, patient, yet fiery—proved more appealing than the lonely far
reaches of space.
Beliakoff sometimes pondered the opportune melting down of their
freighter. He was never able to discover who had signed the order.
But all Mala knew the saying, "An Earthman is easy to catch, but
hard to hold." He wondered whether that had been the true reason
behind the order to scrap the ship.
By this time, of course, he didn't really care; if his wife or Kelly's had
been responsible, it was all the more reason to feel appreciated.
Nob knew the answer, but he had other things on his mind. He lay
awake, restless, until his wife asked worriedly what was wrong.
"I've been wondering," he said. "Those war books that the Earthmen
had us turn in—I never did understand why all those deletions were
made. You know, the ones that made us figure out a way of deciding
which side won."
"But the Earthmen said they used the very same system," she
reminded him. "And they wouldn't lie, would they?"
"They would, if it was for our good. That's what is known as
diplomacy, dear. Statesmanship. Or politics. Interchangeable terms."
She looked impressed. "Oh. And?"
"I've tried to question the crews of ships that land here. The
answers are so evasive that I can't help thinking—"
"Yes, dear?" she prompted.
"—that civilized people actually kill each other in wars."
She turned a shocked face toward him. "How can you think such a
thing? What would be the advantage?"
"Advantage?" he repeated. Then his expression cleared and he fell
back on his pillow, completely relaxed. "I hadn't thought of that,
dear. None, of course. It would really be too much, wouldn't it?"
"No question of it, dear," she said. "Now that that's settled, can you
go to sleep?"
There was no answer. He was already snoring peacefully.
*** END OF THE PROJECT GUTENBERG EBOOK MORAL
EQUIVALENT ***
Updated editions will replace the previous one—the old editions will
be renamed.
Creating the works from print editions not protected by U.S.
copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.
START: FULL LICENSE
THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK
To protect the Project Gutenberg™ mission of promoting the free
distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.
Section 1. General Terms of Use and
Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.
1.B. “Project Gutenberg” is a registered trademark. It may only be
used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
1.E. Unless you have removed all references to Project Gutenberg:
1.E.1. The following sentence, with active links to, or other
immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.
1.E.2. If an individual Project Gutenberg™ electronic work is derived
from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.
1.E.3. If an individual Project Gutenberg™ electronic work is posted
with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.
1.E.4. Do not unlink or detach or remove the full Project
Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.
1.E.5. Do not copy, display, perform, distribute or redistribute this
electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
1.E.7. Do not charge a fee for access to, viewing, displaying,
performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.
1.E.8. You may charge a reasonable fee for copies of or providing
access to or distributing Project Gutenberg™ electronic works
provided that:
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You provide a full refund of any money paid by a user who
notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.
• You provide, in accordance with paragraph 1.F.3, a full refund of
any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™
electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.
1.F.
1.F.1. Project Gutenberg volunteers and employees expend
considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.
1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for
the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.
1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you
discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
1.F.5. Some states do not allow disclaimers of certain implied
warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.
1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,
the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.
Section 2. Information about the Mission
of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.
Volunteers and financial support to provide volunteers with the
assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.
Section 3. Information about the Project
Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.
The Foundation’s business office is located at 809 North 1500 West,
Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact
Section 4. Information about Donations to
the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.
The Foundation is committed to complying with the laws regulating
charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.
While we cannot and do not solicit contributions from states where
we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.
International donations are gratefully accepted, but we cannot make
any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Section 5. General Information About
Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
This website includes information about Project Gutenberg™,
including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.