Tutorial: Rotate a cube in Cascades

This tutorial shows you how to use OpenGL ES in your Cascades app. You create a rotating 3-D cube app by combining the code from the CubeRotate core sample with logic from the GoodCitizenCascades sample app. You use an underlay that is bound to the Screen window.

You will learn to:

  • Create a cube using OpenGL ES
  • Set up the OpenGL ES pipeline in a Cascades app
  • Use ForeignWindowControl
Screen showing the finished app running on a device.

Before you begin

You should have the following things ready:

  • The BlackBerry 10 Native SDK
  • A device or simulator running BlackBerry 10

You can download the tools that you need, then jump into the tutorial to learn how to create, build, and run your first OpenGL ES Cascades project.

Set up your project

Begin by creating an empty project in the Momentics IDE for BlackBerry using the Standard empty project template. If you're not sure how to do this, see Creating a Cascades project.

To reduce some of the extra coding involved with setting up EGL and the Screen window, import the following files into your project.

  1. Download the GoodCitizenCascades code sample from GitHub.

  2. Copy and paste the following files into your new project's src folder:

To link the libraries that your app needs, add the following line to your app's .pro file:

LIBS   += -lpps -lscreen -lEGL -lGLESv1_CM -lfreetype -lpng  -lbb

Last modified: 2015-03-31

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus