Graphics Reference
In-Depth Information
disabled, we do not have to worry about blending factors or the blending func-
tion. Notice that the
DrawHelper::EnableBlending()
function is called dur-
ing
SetupDrawAttributes()
for
each
primitive object. in this way, the alpha-
blending functionality is enabled/disabled for each of the
UWBGL
primitives.
Once again, the support for texture mapping of
UWB
_
Lib13
will be discussed
in the next section.
class
UWB
_
Primitive {
.
A:
public
:
void
EnableBlending(
bool
on );
// Enable/disable primitive blending
bool
IsBlendingEnabled()
const
;
// Query the prmitive's blending state
protected
:
bool
m
_
bBlendingEnabled;
// storage of primitive's blending state
B:
public
:
void
SetTextureFileName(
const wchar
_
t
*
);
// Set texture file name
const wchar
_
t
*
GetTextureFileName();
// Query texture file name
void
EnableTexturing(
bool
on);
// enable/disable primitive file texture mapping
bool
IsTexturingEnabled()
const
;
// Query file texture mapping state
protected
:
bool
m
_
bTexturingEnabled;
// storage of primitive's textere mapping state
std::wstring m
_
TexFileName;
// if enabled, texture file name
.
Source file.
uwbgl
_
Primitive3.h/cpp
files in the
Common Files/
Primitives
};
subfolder
of
the
UWBGL
_
D3D
_
Lib13
project.
void
UWB
_
Primitive::SetupDrawAttributes(UWB
_
DrawHelper& draw
_
helper) {
.
draw
_
helper.EnableBlending( m
_
bBlendingEnabled );
draw
_
helper.SetTextureInfo( m
_
TexFileName.c
_
str() );
draw
_
helper.EnableTexture( m
_
bTexturingEnabled );
.
C:
Listing 12.6.
Modification to
Primitive
for supporting blending and texturing.
Search WWH ::
Custom Search