Running the Sample Application
The PDK comes with a sample app provided to verify and test your setup. The sample app can be run on the following host PCs:
-
Windows PCs - See Running the Sample app on a Windows PC.
-
Apple Macs - See Running the Sample app on a Mac.
Notes:
-
The sample app will not work if your machine does not support OpenGL 2.0. See "All Host PCs" under prerequisites for more information.
-
Starting with webOS 3.0, you can run x86-compiled PDK code in the Emulator in either full-screen or hybrid mode. SDL APIs are supported, but OpenGL ES is not.
-
To build PDK code, you need a separate x86 toolchain. On Windows, you can download the current CodeSourcery G++ Lite cross-compiler.
Running the Sample App on a Windows PC
A sample app (C:\Program Files\HP webOS\PDK\share\samples\simple) is provided with the PDK to verify your setup. You can run this app in one of two ways:
-
From the command line - the sample app runs directly on the device.
-
In the Visual Studio IDE - the sample app is run on the desktop.
When launched in Visual Studio, a red, multi-sided, rotating shape appears in its own app window. When run from the command line, the same rotating shape displays on the device.

Note:
To validate your setup, you only need to run the sample app in one of the described ways. If you are using Visual Studio, you may want to try both, as you will need to do both to develop and test your app.
Running the sample app on the device from the command-line
-
Make sure the device is USB connected, powered and has developer mode enabled.
-
Open a command prompt.
-
Go to the
C:\Program Files\HP webOS\PDK\share\samples\simple\windows\directory. -
Execute the
runit.cmdscript. This script builds the app, then installs and runs it on the device.
In a few seconds, or less, the red, multi-sided, rotating shape displays fullscreen on the device.
Running the sample app in Visual Studio (desktop)
Note:
This procedure steps you through the configurations necessary for developing a desktop app in Visual Studio. Any version of Visual Studio that supports C/C++ should work for developing apps - 2003, 2005 and 2008 have been tested.
To run the sample app in Visual Studio:
-
Launch Visual Studio.
-
Configure the Visual Studio library and header search path to point to HP webOS PDK include header files and code libraries:
-
Select Tools > Options.
-
In the Options dialog box, expand the Projects and Solutions menu.
-
Select VC++ Directories.
-
In the Show Directories for drop-down list box, select Library files.
-
Click your mouse below the last entry in the main text box (or click the Add New Line button).
-
In the entry box that appears, type "C: Files webOS". (Doing this allows Visual Studio projects to link with PDK libraries for host PC development.)
-
In the Show Directories for drop-down list box, select Include files.
-
Repeat steps e and f to add entries for "C: Files webOS" and "C: Files webOS".
-
Click OK.
-
-
Open the simple project file (not backward compatible with 2003):
C:\Program Files\HP webOS\PDK\share\samples\simple\windows\simple.sln. -
Build and run the project (Debug > Start Without Debugging).
A red, multi-sided rotating shape appears in an app window.
Note
In simple.cpp, you can see a few calls needed to use the GLES library:
-
SDL_GL_LoadLibrary() -
_
dgles_load_library()
Since these are only necessary in the desktop environment, they are enclosed in #if WIN32 directives.
In the future, these will be merged into the Windows SDL library and no longer be visible.
Running the sample app on the device from Visual Studio
Completing this procedure is not necessary for verifying your set-up, but running an app directly on the device from Visual Studio can be useful during the development process. Note that this bypasses the normal creating and installing a package on the device method.
-
Launch Visual Studio.
-
Complete the previous procedure - Running the Sample app in Visual Studio - and have the
simpleapp open as your current project. -
Select Tools > External Tools. The External Tools dialog box appears.
-
Click Add.
-
For Title, enter "Run on Device".
-
Next to the Command textbox, click the ... button.
-
Browse to the
...\share\samples\simple\windows\directory and selectrunit.cmd. -
For Initial Directory, select Solution Directory from the menu.
-
Select the Use Output Window check box.
-
Click OK.
-
Make sure the device is powered, has developer mode enabled and is USB-connected.
-
Select Tools > Run on Device.
The red, multi-sided rotating shape should appear fullscreen on the device. For more information about how it was built and transferred, inspect the runit.cmd script.
Running the Sample app on a Mac
A sample app (/opt/PalmPDK/share/samplecode/simple/) is provided with the PDK to test your setup. You can run this app in one of two ways:
-
From the Terminal app - the sample app runs directly on the device.
-
From the Xcode IDE - the sample app runs on the desktop.
Note:
To validate your setup, you only need to run the sample app in one of the described ways. If you are using Xcode, you may want to try both, as you will need to do both to develop and test your app.
Running the sample app on the device
To run the sample app on the device:
-
Make sure the device is USB connected, powered and has developer mode enabled.
-
Launch the Terminal app.
-
Go to
/opt/PalmPDK/share/samplecode/simple/mac. -
Execute the
runit.shscript - "./runit.sh" or "sh runit.sh". -
When prompted for a password, press ENTER.
In a few seconds, or less, a red, multi-sided, rotating shape appears fullscreen on the device.
Running the sample app in the Xcode IDE (desktop)
To run the sample app from the Xcode IDE:
-
Launch Xcode.
-
Open
/opt/PalmPDK/share/samplecode/simple/mac/simple.xcodeproj. -
Click the Build and Run button.
An app window, displaying a red, multi-sided, rotating shape appears.
Note:
Currently, you cannot run apps on the device from Xcode.