Skip to Main Content
3D Game Engine Design, 2nd Edition
book

3D Game Engine Design, 2nd Edition

by David Eberly
November 2006
Intermediate to advanced content levelIntermediate to advanced
1040 pages
26h 31m
English
CRC Press
Content preview from 3D Game Engine Design, 2nd Edition
122 Chapter 2 The Graphics System
EnableAlphaBlending(SBF_SRC_ALPHA,DBF_ONE_MINUS_SRC_ALPHA);
EnableAlphaTesting(1); // alpha reference = 1
// first pass
SetAlphaTestCompare(equal);
EnableDepthWrite();
Draw(objects);
// second pass
SetAlphaTestCompare(not_equal);
DisableDepthWrite();
Draw(objects);
Another application for alpha testing is for drawing objects that have textures
whose alpha values are either 0 or 1. The idea is that the texture in some sense defines
what the object is. A classic example involves applying a decal to an object. The decal
geometry is a rectangle that has a texture associated with it. The texture image has
an artistically drawn object that does not cover all the image pixels. The pixels not
covered are “see-through”; that is,
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

3D Game Engine Architecture

3D Game Engine Architecture

David Eberly
Blender 3D By Example - Second Edition

Blender 3D By Example - Second Edition

Oscar Baechler, Xury Greer
Computer Graphics

Computer Graphics

Alexey Boreskov, Evgeniy Shikin

Publisher Resources

ISBN: 9781482267303