Game Development Reference
In-Depth Information
Understanding the ARToolKit (ARTK)
ARToolKit Professional for Android is a special version of ARToolKit that can be used
especially when developing Android applications.
ASToolkit info and libraries can be found at:
http://www.artoolworks.com/support/library/ARToolKit_for_Android as well as at
http://artoolkit.sourceforge.net/
Listing 9-1 shows the source code for the simpleTest program bundled with the ARToolKit
binaries for Windows. Let's take a closer look.
Listing 9-1. Rendering a Solid Cube on Top of a Pattern
char *patt_name = "Data/patt.hiro";
int patt_id;
double patt_width = 80.0;
double patt_center[2] = {0.0, 0.0};
double patt_trans[3][4];
static void init(void);
static void mainLoop(void);
static void draw( void );
int main(int argc, char **argv)
{
init();
arVideoCapStart();
argMainLoop( NULL, keyEvent, mainLoop );
return (0);
}
/* main loop */
static void mainLoop(void)
{
ARUint8 *dataPtr;
ARMarkerInfo *marker_info;
int marker_num;
int j, k;
/* grab a video frame */
if( (dataPtr = (ARUint8 *)arVideoGetImage()) == NULL ) {
arUtilSleep(2);
return;
}
if( count == 0 ) arUtilTimerReset();
count++;
argDrawMode2D();
argDispImage( dataPtr, 0, 0 );
 
Search WWH ::




Custom Search