## How to create the basic structure of a new 3d application

The first thing to when creating a new 3d application with the engine is to set up a class that extends the "AbstractBaseGame" super class. "AbstractBaseGame" specifies three important abstract methods (initResources(), update(), draw()) which form the basic structure of every application that can be done with the engine.
The initResources() method is meant to be place where to create and initialise all of your application's resources, such as 3d-models, sounds and special effects.
The update() method is used to update the application's resources. It is called in every frame of the application. Most of the possible resources provide an update() method themselves which should be called within this method.
The draw() method is used to place code in it that draws the application's resources. Just like the update() method it is called in every frame, too.
To create and executable application you have to insert Java's familiar main() method and create a new object of the class. Take a look at the example code to see which steps need to be done to configure and launch the application.

`01 package tutorial; 02 import javax.media.opengl.GL; 03 import javax.media.opengl.GLDrawable; 04 05 import de.rico.engine.game.AbstractBaseGame; 06 07 /** 08 * A class that shows how to create the basic structure of a 09 * new 3d application 10 * @author Frank Bruns 11 * 12 */ 13 public class NewApplication extends AbstractBaseGame 14 { 15 /** 16 * Constructor for the new game. 17 * @param title title for the window bar 18 * @param maxFps maximum possible framerate 19 */ 20 public NewApplication(String title, int maxFps) 21 { 22 super(title, maxFps); 23 } 24 25 /* (non-Javadoc) 26 * @see de.rico.engine.game.AbstractBaseGame#initResources(javax.media.opengl.GLDrawable, javax.media.opengl.GL, int, int) 27 */ 28 @Override 29 public void initResources(GLDrawable gld, GL gl, int width, int height) 30 { 31 // initialise your game resources here 32 } 33 34 /* (non-Javadoc) 35 * @see de.rico.engine.game.AbstractBaseGame#update(long) 36 */ 37 @Override 38 public void update(long elapsedTime) 39 { 40 // update your game resources here 41 } 42 43 /* (non-Javadoc) 44 * @see de.rico.engine.game.AbstractBaseGame#draw(javax.media.opengl.GL) 45 */ 46 @Override 47 public void draw(GL gl) 48 { 49 // draw your game resources here 50 } 51 52 public static void main(String args[]) 53 { 54 // create a new game 55 NewApplication game = new NewApplication("Test Game", 100); 56 57 // initialise the camera --> needs to be done! 58 game.initCamera(0f, 0f, 0f, 0f, 0f, 0.1f, 200f); 59 60 // show framerate --> this is optional 61 game.setDisplayFPS(true); 62 63 // finally start the game 64 game.start(game); 65 } 66 }`
Java2html

After executing the code you should see a display resolution dialog. Choose a resolution suitable for you and press "OK". If everything is correct there should be an empty gray window showing up on the screen that merely contains the current framerate and looks like the one in the picture below.
.