Before you begin
You should have a basic understanding of the C/C++ languages and some experience running applications with the QNX Momentics IDE. Before starting this tutorial, you should have the following things ready:
- The BlackBerry 10 Native SDK
- Your BlackBerry 10 device or simulator
Create your project
Since we don't want to write all of the setup code from scratch, let's create a project using the BlackBerry 10 OS OpenGL ES 1.1 Application Template Project. The main reason we use this template is that it includes a file called bbutil.h. The bbutil.h file contains convenient functions that you can call from your application. These functions help you perform common tasks such as initializing and terminating EGL, loading and rendering text and textures, and resizing your EGL surface, as a part of orientation change handling.
- In the QNX Momentics IDE, click File > New > BlackBerry Project .
- In the New BlackBerry Project Wizard, select the Project Type Application and then select OpenGL.
- Click Next.
- Select the template OpenGL ES 1.1. Click Next.
- Provide a project name, such as HelloNativeSDK. Click Finish.
Set up your device or simulator
If this is your first project, you will see the Deployment Setup Wizard automatically launch. Follow the Wizard to set up your deployment environment using either a BlackBerry 10 device or simulator. Note that to complete Device Setup on the Wizard, you must to turn on Developer Mode on your device and get the IP address of your device or simulator. For more information about using the wizard and turning on development mode, see Set up your environment.
After you complete the Deployment Setup Wizard, the project appears in the Project Explorer view.
What's in your project
Your brand new project contains a few folders and files. All source code is in the src folder; images are directly under the project folder; when you build the project, the binaries will appear in the Binaries folder. You have three source code files:
- main.c, which includes the main() function as well as initialization, event handling, and rendering functions.
- bbutil.h and bbutil.c, which provide convenient utility functions for commonly used operations such as loading textures and rendering text.