design of a 2d graphics engine by joe hallahan. what is an engine? software engine: core of the...
TRANSCRIPT
Design of a 2D Graphics Engine
By Joe Hallahan
What is an Engine?
Software engine: core of the program Internal as opposed to visible
Others (physics, database) excel at one task only, “software engine” is more general
Emphasis on graphics
Benefits
Reusable, safe
Framework for program – everything else is specific/detail work
Purpose
To create an engine using C++, OpenGL, and SDL that can simplify the process required for creating a graphical application by rendering graphics automatically and providing support for other general functions
Design - Tools
C++ Fast, efficient
SDL Free Makes many functions easier Works well with OpenGL Cross-platform
Design - Tools
OpenGL 2D and 3D support Can be hard to learn/use Free, supported on most systems Really really fast
Design - Structure
Engine.h contains declarations of variables, functions, classes, also includes external libraries
Engine.cpp defines everything declared in Engine.h
A third program can be used to test the engine, all that is really necessary is the main() method
Problems to Overcome
Data structure– Array used– Holds Shapes– Only holds up to 100 objects
Testing
#include "Engine.h"
int main(int argc, char* argv[]){
Engine e;
e.run();
return 0;
}
Testing
Testing / Analysis
3 test programs Simple Test
Bare minimum – no external program, just a main method Pong
Game, familiar Simple, controls supported through SDL
Engine Demo Colors Collisions
Conclusion
Engine works correctly Performance mainly hardware dependent,
should be about as efficient as a normal program made without using engine
No performance loss
Expandability
3D support Sound More inputs More performance tweaks Better collision detection
Will hurt performance in most cases Specialization
Bibliography• -Development of a 3D Graphics Engine (Kassing)• -Modular Architecture for Computer Game
Design (McNeill)• -Multi-threaded Game Engine (Tulip, Bekkema,
Nesbitt)• -Interactive 3D Geometry in OpenGL (Welsh)• -FROG: The Fast \& Realistic OPENGL
Displayer• -Simple and rapid collision detection using
multiple viewing volumes (Fan, Wan, Gao)