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
18.8 Initialization and Ter mination 823
// contents of MyClass.cpp
Matrix2 Matrix2::TWICE_IDENTITY = Matrix2::IDENTITY*2.0f;
If the static matrix of MyClass is initialized first, the static matrix of Matrix2 has all
zero entries, since the storage is reserved already by the compiler but is set to zero
values as is all static data.
Problems can occur with file-static data. If a file-static pointer is required to
allocate memory, this occurs before the main application is launched. However, since
such an initialization is C-style and not part of class semantics, code is not generated
to deallocate the memory. For example,
int* g_aiData = new int[17];
int main ()
{
memset(g_aiData,0,17*sizeof(int));
return 0;
}
The global variable g_aiData is allocated premain, ...
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