Creating a Rounded Rectangle in OpenGL

OpenGL is an extremely low level language, and is more or less only capable of drawing triangles. This means that many of the basic shapes that developers are used to having available in a drawing API are not present and must be created from scratch. The below code demonstrates how to draw a rounded rectangle in OpenGL.

static const GLfloat roundRect[] = {
    .92,0,
    .933892,.001215,
    .947362,.004825,
    .96,.010718,
    .971423,.018716,
    .981284,.028577,
    .989282,.04,
    .995175,.052638,
    .998785,.066108,
    1,.08,
    1,.92,
    .998785,.933892,
    .995175,.947362,
    .989282,.96,
    .981284,.971423,
    .971423,.981284,
    .96,.989282,
    .947362,.995175,
    .933892,.998785,
    .92,1,
    .08,1,
    .066108,.998785,
    .052638,.995175,
    .04,.989282,
    .028577,.981284,
    .018716,.971423,
    .010718,.96,
    .004825,.947362,
    .001215,.933892,
    0,.92,
    0,.08,
    .001215,.066108,
    .004825,.052638,
    .010718,.04,
    .018716,.028577,
    .028577,.018716,
    .04,.010718,
    .052638,.004825,
    .066108,.001215,
    .08,0
};

static const GLfloat vbox[] =
{
    0.0f, 0.0f,
    1.0f, 0.0f,
    0.0f, 1.0f,
    1.0f, 1.0f,
};

void render()
{
    setStale(false);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer(2, GL_FLOAT, 0, vbox);
    glPushMatrix();
    glColor4f(0.0f,1.0f,0.0f,1.0f);
    glScalef(.75, .75, 1.0f);
    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer(2, GL_FLOAT, 0, roundRect);
    glDrawArrays(GL_TRIANGLE_FAN, 0, 40);
    glPopMatrix();
    glDisableClientState(GL_VERTEX_ARRAY);
    setStale(true);
}

Careful observation of the code (especially the line glDrawArrays(GL_TRIANGLE_FAN, 0, 40);) will point out that that technically OpenGL is once again just drawing a collection of 40 triangles in order to create the rounded rectangle shape.

Hockey Scores updated for 2014-2015 season

Z10The Hockey Scores app has been updated to version 3.2 for the new NHL season. This app supports all BlackBerry phones running OS 5.0 or higher, including all BlackBerry 10 phones.

About Hockey Scores

This application provides the day’s hockey scores is an intuitive and easy to use format. It also includes additional game statistics such as start times, goal scorers, shots on net, hits, faceoff percentage, team Corsi numbers, and lists out the goal scorers.

New in version 3.2

This update adds some features to the BlackBerry 10 app that adds support for the BlackBerry Passport, adds a swipe down menu, and optimizes the screen layout for some devices.

Links & Information

Looking at who is currently using the Porsche Design phones

With last Wednesday’s announcement of the Porsche Design P’9983 BlackBerry it may be a good idea to take a look at who is currently using the previous iterations of these high priced phones. Based on data collected by BlackBerry World for downloads of the popular game Pixelated, it was possible to identify the countries that the P’9981 and P’9982 are currently being used in.

Porsche

As with most things BlackBerry, the greatest support comes from Canada, with the majority of users in North America. The following countries mostly confirm the stereotype of Porsche targeting oil rich nations such as Saudi Arabia and the United Arab Emirates. In fact anytime that Bahrain accounts for over two percent of the market, you can safely assume that oil money is a contributing factor.

App sales plummeting for the Nook

A little over two years ago when I first began selling Android apps, the Barnes and Noble Nook was a powerful player. While this store did not get the same attention as Google Play and Amazon’s App Store, for many months I had more sales through the Nook Bookstore then the other two combined. This came as a bit of a surprise, but has certainly not lasted.

Once accounting for over 70% of Android app sales for me, the number has been on a long term downward trajectory and has been below 10% for most of 2014. The below chart shows the percentage of Android sales of Ebscer apps through the Nook Bookstore.

NookChart

A few factors have contributed to this. First, the Nook (while often updated) has not kept pace with the other tablets on the market. More importantly Barnes and Noble has mostly given up on their platform, choosing the bundle Google Play on some of their newer devices, and have recently just launched the confusingly named “Samsung Galaxy Tab 4 Nook” as they try to get out of the electronics business altogether.

However, if you are still interested in buying some apps for your Nook visit barnesandnoble.com/s/ebscer.

BBOS distribution unchanged in August

While the market share of OS 7 is up 13.1 percentage points from August 2013, there has been little to no change in the mix of BBOS devices used last month.

StatsAugust2014

This data was collected by BlackBerry World for downloads of the free BlackBerry strategy game Pixelated. Data shown on the chart is from the beginning of August 2013 through the end of August 2014, and does not include BlackBerry 10 or PlayBook devices.

Processing .html files as PHP

In the interest of having cleaner URLs (or simply to maintain existing links) it is often desirable for webpages to end in a .html extension even if they need to be processed as PHP. On Apache servers this is very straight forwards and you just add the following lines of code to your .htaccess file

AddType x-mapp-php5 .php .htm .html

On Windows servers this is slightly more complicated (as are most things). You need the following code in your web.config file and the value for the scriptProcessor is based on the install location of your php-cgi.exe file. Finding the location of this file can often be teased out by looking at the results from the phpinfo(); command.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
		<handlers>
            <add name="PHP_via_FastCG1" path="*.htm" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP5.5\php-cgi.exe" resourceType="Either" />
            <add name="PHP_via_FastCG2" path="*.html" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP5.5\php-cgi.exe" resourceType="Either" />
        </handlers>
    </system.webServer>
</configuration>

BlackBerry 10 device useage

As BlackBerry prepares to launch the Passport, the majority of users are still using the original BlackBerry 10 device, the Z10. The data below represents the 19,238 users who downloaded the Stuff I Need app in the month of August.

Aug2014Devices

All of these statistics are based off of the data collected by BlackBerry World for downloads of the free check-list app Stuff I Need (which is also available for Windows Phone and Android users).

BlackBerry 10 sees a slight increase in use of newer OS versions

After leveling off in July, August saw a good uptake of newer versions of the operating system. Last month 89.1% of Pixelated users were running the newest version of the OS. Meanwhile 93.7% of Stuff I Need users were running OS 10.2.1 on their phones.

2014Aug-Pixelated-BB10OSVersions

2014Aug-StuffINeed-BB10OSVersions

This data was collected by BlackBerry World for downloads of the free strategy game Pixelated and the free checklist app Stuff I Need. Data shown on the chart is from the beginning of August 2013 through the end of August 2014.

New version of Pixelated Shapes

IMG_00000136Pixelated Shapes has been updated to version 1.3 for Android, BlackBerry, and Windows 8. This updated reduces the file size by 7% for the BlackBerry 10 version of the app, while also adding support for the BlackBerry Passport that is due to be released next month. Meanwhile the Windows 8 version of the app got updated in order to better support the variable sized side by side apps supported by Windows 8.1

About Pixelated Shapes

Pixelated Shapes is a twist on the classic version of Pixelated that replaces the familiar squares with triangles and hexagons. The object of the game is to get the screen a single color by slowly growing a blob out of the upper left hand corner by matching it to the colors of the surrounding shapes. This is done repeatedly until either the game is won, or you run out of moves. Under the default settings you must clear the screen in 29 moves or less in order to win. A one time in-app upgrade can allow you to adjust the difficult, switch color schemes, change to different game modes, and get an indicator giving you the number of remaining moves.

Links & Information

150

Morse Code app updated for BlackBerry Passport

Q10The BlackBerry 10 Morse Code app has been updated to version 2.2 in BlackBerry AppWorld. This new version of the app includes a number of optimizations and also adds support for the BlackBerry Passport.

About Morse Code

This app will take your text, and translate it back to you in Morse Code. Any text can simply be entered, and then by pressing the “Play Morse Code” button, can be turned into an audible Morse Code signal. The application also allows you to adjust the speed of the playback in words per minute in order to accommodate different skill levels.

Links & Information

App released for the Champlain Canal

IMG_20140817_233813A brand new app has just been released in order to help you navigate the Champlain Canal in upstate New York. The app can be download from BlackBerry World, Google Play, and the Amazon Appstore.

With apps having already been released for the Erie Canal, Cayuga-Seneca Canal, and Oswego Canal there are now apps available for navigating the whole New York State canal system. These apps give you the ability to see the locations of all locks and boat launches along the canals. Additionally the apps also contain a map view to give a visual representation to where everything is.

Links & Information

114

Stuff I Need checklist app updated

CampingListCropThe Stuff I Need check list app has been updated to version 2.5 for BlackBerry and Android. For BlackBerry 10 users the app makes a few visual tweaks, support for the BlackBerry Passport, and has also been optimized to give the app a 15% reduction in file size. For Android users the newest version of the app allows you to set a custom text size, which is a feature that was added to the BlackBerry version of the app last summer.

Amazon Appstore

The Android version of the app is also now available in the Amazon Appstore.

About Stuff I Need

Originally conceived as a grocery list app, this minimalistic checklist app can be used to keep track of the stuff you need to get, or the stuff that you need to do. New items can be added to list with the ‘Add’ button on the bottom of the screen. Items on the list can be edited (or deleted) by giving them a long press. Lists can be switched by pulling down on the tab at the top of the screen. This will expose a spinner that shows all of your current lists. New lists can be added by using the “+” button on the right side of the expanded tab. Making use of three or more lists requires the use on a one time in-app purchase. Lists are automatically deleted if you delete all items in a list and restart the app.

Links & Information

icon300

Creating new projects to optimize BlackBerry 10 apps

Since first releasing the BlackBerry 10 SDK in early 2012, BlackBerry has continued to work on improving their tools. I have recently discovered that significant optimizations are made in newly created Cascades projects. I am currently working on an update to my Stuff I Need app, and have been able to get a 17% reduction in the app’s file size simply by recreating the project from scratch in Momentics. In addition to the smaller install size, the app also appears to be launching quicker. This was done with no changes at all to my code. Using all of the same assets, qml, and c++ files, I created a new project, and then copied my existing files in. The new project contains a few changes to the .pro and the bar-descriptor.xml files, but the majority of the changes seem to be taking place behind the scenes. So for anyone that has been writing BlackBerry Cascades apps for a while now, it may be worth it to recreate your apps and get some free optimizations to your code.

Starbeams gets another 10 levels

Z10Starbeams has been updated to version 1.8 for BlackBerry 10 and Windows 8. This update adds an additional ten levels, and also adds support for the soon to be released BlackBerry Passport.

About Starbeams

The object of the game is to assign colors to each star in order to ensure that none of the stars are connected to another star of the same color. The game starts off easy, but quickly gets more complex, adding more colors and seven pointed stars that can not be changed.

Links & Information

IconS150

Update released for the Rotary Phone App

Q10-3The Rotary Phone app has just been updated to version 1.1 in BlackBerry World. This app sends your phone back in time, and gives you a classic rotary interface from which to dial out numbers. There is even a setting that allows you to automatically dial out after seven or ten digits have been entered. The new version of the app has an install size that is 14% smaller, and also adds support for the soon to be released BlackBerry Passport.

Video

Links & Information

BB_World_Small