Exemple #1
0
long Viewport::onConfigure(FXObject*,FXSelector,void*)
{
	glInit();
	reproject = true;

	return 1;
}
//This function initializes the device to a "default" setting. 
//You may begin sending GL commands to the DS after this function executes
void blu_impl::GFX_Init3DDevice(){
videoSetMode(MODE_0_3D);

// initialize the geometry engine
glInit();

// enable antialiasing
glEnable(GL_ANTIALIAS);

// setup the rear plane
glClearColor(0,0,0,31); // BG must be opaque for AA to work
glClearPolyID(63); // BG must have a unique polygon ID for AA to work
glClearDepth(0x7FFF);

// Set our viewport to be the same size as the screen
glViewport(0,0,255,191);

// this controls your camera 
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(70, 256.0 / 192.0, 0.1, 100);

//ds specific, several attributes can be set here       
glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE);
// Set the current matrix to be the model matrix
glMatrixMode(GL_MODELVIEW);
}
Exemple #3
0
	void init3DSettings() {
		glInit();
		glEnable(GL_TEXTURE_2D | GL_ANTIALIAS | GL_BLEND);

		glClearColor(31, 31, 31, 0);
		glClearPolyID(63);
		glClearDepth(GL_MAX_DEPTH);

		glViewport(0, 0, 255, 191);

		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();

		glFrustum(-6.4, 6.4, -4.8, 4.8, 6.4, 25);

		glMaterialf(GL_AMBIENT, RGB15(8, 8, 8));
		glMaterialf(GL_DIFFUSE, RGB15(23, 23, 23));
		glMaterialf(GL_SPECULAR, BIT(15) | RGB15(8, 8, 8));
		glMaterialf(GL_EMISSION, RGB15(5, 5, 5));
		glMaterialShinyness();

		glLight(0, RGB15(31, 31, 31), floattov10(4.0), 0, floattov10(-0.8));
		glLight(1, RGB15(31, 31, 31), floattov10(-4.0), 0, floattov10(-0.8));
		glLight(2, RGB15(31, 31, 31), 0, floattov10(-4.0), floattov10(-0.8));
		glLight(3, RGB15(31, 31, 31), 0, floattov10(4.0), floattov10(-0.8));

		glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0
				| POLY_FORMAT_LIGHT1 | POLY_FORMAT_LIGHT2 | POLY_FORMAT_LIGHT3);
	}
int pl110_MakeCurrent(pl110_Context *ctx ){
	int	mode;
	int	xsize;
	int	ysize;

	ZBuffer *zb;

	if( ctx->gl_context == NULL ){
		xsize = 640;
		ysize = 480;
		mode = ZB_MODE_5R6G5B;

		zb = ZB_open( xsize, ysize, mode, 0, NULL, NULL, NULL);
		
		if( zb == NULL ) {
			return 0;
		}

		/* initialisation of the TinyGL interpreter */
		glInit( zb );
		ctx->gl_context                     = gl_get_context();
		ctx->gl_context->opaque             = (void *) ctx;
		ctx->gl_context->gl_resize_viewport = pl110_resize_viewport;

		/* set the viewport */
		/*  TIS: !!! HERE SHOULD BE -1 on both to force reshape  */
		/*  which is needed to make sure initial reshape is  */
		/*  called, otherwise it is not called..  */
		ctx->gl_context->viewport.xsize = xsize;
		ctx->gl_context->viewport.ysize = ysize;
		glViewport( 0, 0, xsize, ysize );
	}
	return 1;
}
int main(int argc, char **argv) 
{
	printf("Strips count: %d\n", SIZE);

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
	glutInitWindowPosition(windowPosX,windowPosY);
	glutInitWindowSize(windowWidth,windowHeight);
	
	glutCreateWindow(title);

	glutDisplayFunc(OnDraw); 
	glutReshapeFunc(OnReshape);
	glutKeyboardFunc(OnProcessNormalKeys);
	//glutIdleFunc(renderScene);//idle function
	glutTimerFunc(time01, OnTimer01, 0);
	
	glutMouseFunc(OnMouseClick);
	glutPassiveMotionFunc(OnMousePassiveMotion); //when no buttons are pressed
	glutMotionFunc(OnMouseMotion); //when buttons are pressed

	glInit();
	glutMainLoop();

	return 0;
}
Exemple #6
0
int main(int argc, char** argv) {
	if(argc <= 1) {
		fileName = malloc((strlen(MODEL_FILE) + 1) * sizeof(char));
		fileName[0] = 0;
		strcat(fileName, MODEL_FILE);
	}
	else {
		fileName = malloc((strlen(argv[1]) + 1) * sizeof(char));
		fileName[0] = 0;
		strcat(fileName, argv[1]);
	}
	
	mesh = readMesh(fileName, dimensions);
	//keyboardInput('9', 0, 0);
	
	atexit(deallocate);
	glutInit(&argc, argv);
	glutInitWindowSize(width, height);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutCreateWindow("Mesh Simplification");
	
	glInit();
	
	glutReshapeFunc(reshape);
	glutDisplayFunc(tick);
	//glutIdleFunc(tick);
	glutSpecialFunc(specialInput);
	glutKeyboardFunc(keyboardInput);
	
	glutMainLoop();
	
	return 0;
}
Exemple #7
0
void initEditor(void)
{
	lcdMainOnBottom();
	videoSetMode(MODE_5_3D);
	videoSetModeSub(MODE_5_2D | DISPLAY_BG3_ACTIVE);
	
	vramSetPrimaryBanks(VRAM_A_TEXTURE,VRAM_B_TEXTURE,VRAM_C_SUB_BG,VRAM_D_TEXTURE);	
	
	glInit();
	
	glEnable(GL_TEXTURE_2D);
	// glEnable(GL_ANTIALIAS);
	glEnable(GL_BLEND);
	glEnable(GL_OUTLINE);
	
	glClearPolyID(63);
	glClearDepth(0x7FFF);
	glViewport(0,0,255,191);
	
	initVramBanks(1);
	initTextures();
	
	initRoomEdition();
	NOGBA("START mem free : %dko (%do)",getMemFree()/1024,getMemFree());

	fadeIn();
}
int main(int argc, char **argv)
{
	XnStatus nRetVal = XN_STATUS_OK;

	if (argc > 1)
	{
		nRetVal = g_Context.Init();
		CHECK_RC(nRetVal, "Init");
		nRetVal = g_Context.OpenFileRecording(argv[1]);
		if (nRetVal != XN_STATUS_OK)
		{
			printf("Can't open recording %s: %s\n", argv[1], xnGetStatusString(nRetVal));
			return 1;
		}
	}
	else
	{
		nRetVal = g_Context.InitFromXmlFile(SAMPLE_XML_PATH);
		CHECK_RC(nRetVal, "InitFromXml");
	}
	g_tunnel = new Tunnel();

	nRetVal = g_Context.FindExistingNode(XN_NODE_TYPE_DEPTH, g_DepthGenerator);
	CHECK_RC(nRetVal, "Find depth generator");
	nRetVal = g_Context.FindExistingNode(XN_NODE_TYPE_USER, g_UserGenerator);
	if (nRetVal != XN_STATUS_OK)
	{
		nRetVal = g_UserGenerator.Create(g_Context);
		CHECK_RC(nRetVal, "Find user generator");
	}

	XnCallbackHandle hUserCallbacks, hCalibrationCallbacks, hPoseCallbacks;
	if (!g_UserGenerator.IsCapabilitySupported(XN_CAPABILITY_SKELETON))
	{
		printf("Supplied user generator doesn't support skeleton\n");
		return 1;
	}
	g_UserGenerator.RegisterUserCallbacks(User_NewUser, User_LostUser, NULL, hUserCallbacks);
	g_UserGenerator.GetSkeletonCap().RegisterCalibrationCallbacks(UserCalibration_CalibrationStart, UserCalibration_CalibrationEnd, NULL, hCalibrationCallbacks);

	if (g_UserGenerator.GetSkeletonCap().NeedPoseForCalibration())
	{
		g_bNeedPose = TRUE;
		if (!g_UserGenerator.IsCapabilitySupported(XN_CAPABILITY_POSE_DETECTION))
		{
			printf("Pose required, but not supported\n");
			return 1;
		}
		g_UserGenerator.GetPoseDetectionCap().RegisterToPoseCallbacks(UserPose_PoseDetected, NULL, NULL, hPoseCallbacks);
		g_UserGenerator.GetSkeletonCap().GetCalibrationPose(g_strPose);
	}

	g_UserGenerator.GetSkeletonCap().SetSkeletonProfile(XN_SKEL_PROFILE_ALL);

	nRetVal = g_Context.StartGeneratingAll();
	CHECK_RC(nRetVal, "StartGenerating");

	glInit(&argc, argv);
	glutMainLoop();
}
Exemple #9
0
void SceneDrawer::DrawScene(UserTracker *pUserTrackerObj,int argc, char **argv,SampleManager *pSample, XnBool bShowLowConfidence)
{
    m_pUserTrackerObj=pUserTrackerObj;
    m_pSample=pSample;
    m_bShowLowConfidence=bShowLowConfidence;

#ifndef USE_GLES
    glInit(&argc, argv);
#endif

    InitTexture();
#ifndef USE_GLES
    glutMainLoop();
#else
    if (!opengles_init(GL_WIN_SIZE_X, GL_WIN_SIZE_Y, &display, &surface, &context))
    {
        printf("Error initializing opengles\n");
        ExitSample(EXIT_FAILURE);
    }

    glDisable(GL_DEPTH_TEST);
    glEnable(GL_TEXTURE_2D);
    glEnableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_COLOR_ARRAY);

    while (1)
    {
        glutDisplay();
        eglSwapBuffers(display, surface);
    }
    // we should never reach here! we have a while(1) above!
    ExitSample(EXIT_SUCCESS);

#endif
}
void QGLBlitter::SubWidget::setBufferDimensions(const unsigned int width, const unsigned int height) {
    inWidth = width;
    inHeight = height;

    textureRes = std::max(width, height);

    //Next power of 2
    --textureRes;
    textureRes |= textureRes >> 1;
    textureRes |= textureRes >> 2;
    textureRes |= textureRes >> 4;
    textureRes |= textureRes >> 8;
    textureRes |= textureRes >> 16;
    ++textureRes;

    if (!initialized)
        glInit();
// 	else
// 		makeCurrent();

    glLoadIdentity();

    {
        const Array<quint32> nulltexture(textureRes * textureRes); // avoids bilinear filter border garbage
        std::memset(nulltexture, 0, nulltexture.size() * sizeof(quint32));
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, textureRes, textureRes, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nulltexture);
    }

    glOrtho(0, 1, 1, 0, -1, 1);

    resizeGL(this->width(), this->height());
}
Exemple #11
0
void main (void)

{

	glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_FULLSCREEN);

	glutInitWindowSize (winW,winH);

	glutCreateWindow (APP_NAME);

	glutKeyboardFunc (glutKeyboard);

	glutDisplayFunc (glutDisplay);

	glutReshapeFunc (glutResize);



	glInit ();



	glutMainLoop(); // we never return...

}
void GLWindow::ensureInitialized()
{
	if( !mInitialized )
		glInit();
	else if( QGLContext::currentContext() != context() )
		makeCurrent();
}
Exemple #13
0
int main(int argc, char *argv[])
{
    //OpenCVの初期化
    cvInit();
	
    //OpenGLとGLUTの初期化
    //(OpenCVみたいにまとめないのはargcとargvが必要だから?)
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA);
    glutInitWindowSize(width, height);
    glutCreateWindow("IplImage");
    glutDisplayFunc(display);
    glutKeyboardFunc(keyboard);
    glInit();
    
    
    GLUI *glui = GLUI_Master.create_glui("control");
    glui->add_button("Exit", 0, gluiCallback);

	
    //メインループ突入(displayを繰り返し実行)
    glutMainLoop();
    
    return 0;
}
Exemple #14
0
int main(int argc, char **argv)
{
	InitOpenNI(argc, argv);
	glInit(&argc, argv);
	glutMainLoop();
	
	return 1;
}
Exemple #15
0
long Viewport::onCmdTexture(FXObject* , FXSelector, void* )
{
	RenderMode.Texture = !RenderMode.Texture;
	updateButtons();
   glInit();
	redraw();
	return 1;
}
Exemple #16
0
long Viewport::onCmdSolid(FXObject* , FXSelector, void* )
{
	RenderMode.Solid = !RenderMode.Solid;
	updateButtons();
   glInit();
	redraw();
	return 1;
}
Exemple #17
0
void GLWnd::setDoubleBuffered(int db) {
  if (db == m_doublebuffered) return;
  m_doublebuffered = db;
  if (m_rendercontext) {
    glShutdown();
    glInit();
  }
}
Exemple #18
0
long Viewport::onCmdPatch(FXObject* , FXSelector, void* )
{
	RenderMode.ShowPatch = !RenderMode.ShowPatch;
	updateButtons();
   glInit();
	redraw();
	return 1;
}
Exemple #19
0
long Viewport::onCmdCullFace(FXObject* , FXSelector, void* )
{
  RenderMode.Cullface = !RenderMode.Cullface;
  updateButtons();
	glInit();
  redraw();
	return 1;
}
Exemple #20
0
int main() {
		
	// Setup the Main screen for 3D 
	videoSetMode(MODE_0_3D);
		
	// initialize the geometry engine
	glInit();
	
	// enable antialiasing
	glEnable(GL_ANTIALIAS);
	
	// setup the rear plane
	glClearColor(0,0,0,31); // BG must be opaque for AA to work
	glClearPolyID(63); // BG must have a unique polygon ID for AA to work
	glClearDepth(0x7FFF);
	
	// Set our viewport to be the same size as the screen
	glViewport(0,0,255,191);
	
	// setup the view
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(70, 256.0 / 192.0, 0.1, 100);
	
	
	//ds specific, several attributes can be set here	
	glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE);
	
	while (1) 
	{
		// Set the current matrix to be the model matrix
		glMatrixMode(GL_MODELVIEW);
		
		glColor3f(1, 1, 1);									// Set the color..not in nehe source...ds gl default will be black
		
		//Push our original Matrix onto the stack (save state)
		glPushMatrix();	

		DrawGLScene();
		
		// Pop our Matrix from the stack (restore state)
		glPopMatrix(1);

		//a handy little built in function to wait for a screen refresh
		swiWaitForVBlank();

		// flush to screen	
		glFlush(0);

		scanKeys();

		int pressed = keysDown();

		if(pressed & KEY_START) break;	
	}
	
	return 0;
}
int CAP::main(int argc, char *argv[]) {
  glutInit(&argc, argv);
  glutInitWindowSize(700, 700);
  glutCreateWindow("Cylinder and parallelpiped");
  glInit();
  glutDisplayFunc(display);
  glutMainLoop();
  return 0;
}
Exemple #22
0
void OgreWidget::bindToWindow()
{
  glInit();
  create();
  //== Creating and Acquiring Ogre Window ==//

  // Get the parameters of the window QT created
  Ogre::String winHandle;
#ifdef WIN32
  // Windows code
  winHandle += Ogre::StringConverter::toString((unsigned long)(OgreWidget->parentWidget()->winId()));
#elif MACOS
  // Mac code, tested on Mac OSX 10.6 using Qt 4.7.4 and Ogre 1.7.3
  Ogre::String winHandle  = Ogre::StringConverter::toString(winId());
#else
  // Unix code
  winHandle = Ogre::StringConverter::toString((unsigned long)(this->window()->winId()));
#endif

  Ogre::NameValuePairList params;
#ifndef MACOS
  // code for Windows and Linux
  params["parentWindowHandle"] = winHandle;
  params["externalGLControl"] = "true";
  params["currentGLContext"] = "true";
  mWindow = mRoot->createRenderWindow( "QOgreWidget_RenderWindow",
                           this->width(),
                           this->height(),
                           true,
                           &params );

  mWindow->setActive(true);

  // bug fix, extract geometry
  QRect geo = this->frameGeometry ( );

  // set geometrie infos to new window
  this->setGeometry (geo);
  setMinimumSize(1,1);

#else
  // code for Mac
  params["externalWindowHandle"] = winHandle;
  params["macAPI"] = "cocoa";
  params["macAPICocoaUseNSView"] = "true";
  mWindow = mRoot->createRenderWindow("QOgreWidget_RenderWindow",
      width(), height(), false, &params);
  mWindow->setActive(true);
  makeCurrent();
#endif

  setAttribute( Qt::WA_PaintOnScreen, true );
  setAttribute( Qt::WA_NoSystemBackground );
  setAttribute( Qt::WA_NoBackground );
  setAttribute( Qt::WA_NativeWindow );
}
Exemple #23
0
void initMenu(void)
{
	lcdMainOnTop();
	videoSetMode(MODE_5_3D);
	videoSetModeSub(MODE_5_2D);
	
	vramSetPrimaryBanks(VRAM_A_TEXTURE,VRAM_B_TEXTURE,VRAM_C_SUB_BG,VRAM_D_TEXTURE);	
	
	initD3D();

	glInit();
	
	glEnable(GL_TEXTURE_2D);
	glEnable(GL_ANTIALIAS);
	glEnable(GL_BLEND);
	glEnable(GL_OUTLINE);
	
	glClearPolyID(63);
	glClearDepth(0x7FFF);
	glViewport(0,0,255,191);
	
	initVramBanks(2);
	initTextures();

	initMenuScene();

	initMenuButtons();

	//TEMP
	glLight(0, RGB15(31,31,31), cosLerp(4096), 0, sinLerp(4096));

	glMaterialf(GL_AMBIENT, RGB15(8,8,8));
	glMaterialf(GL_DIFFUSE, RGB15(24,24,24));
	glMaterialf(GL_SPECULAR, RGB15(0,0,0));
	glMaterialf(GL_EMISSION, RGB15(0,0,0));

	glSetToonTableRange(0, 15, RGB15(8,8,8)); //TEMP?
	glSetToonTableRange(16, 31, RGB15(24,24,24)); //TEMP?

	applyCameraState(&menuCamera,&cameraStates[4]);
	tempState=cameraStates[4];
	testTransition=startCameraTransition(&cameraStates[1],&cameraStates[4],64);

	setupMenuPage(startMenuPage, startMenuPageLength);

	logoMain=createTexture("logo.pcx", "menu");
	logoRotate=createTexture("rotate_logo.pcx", "menu");
	logoAlpha=31;

	glSetOutlineColor(0,RGB15(0,0,0)); //TEMP?
	glSetOutlineColor(1,RGB15(0,0,0)); //TEMP?
	glSetOutlineColor(7,RGB15(0,0,0)); //TEMP?

	NOGBA("END mem free : %dko (%do)",getMemFree()/1024,getMemFree());
	fadeIn();
}
Exemple #24
0
void hello_create(helloObjectInstance *me) {
	glInit();
	glEnable(GL_ANTIALIAS);
	
	glClearColor(0, 0, 0, 31);
	glClearPolyID(63);
	glClearDepth(0x7FFF);
	
	glViewport(0, 0, 255, 191);
}
Exemple #25
0
int main(int argc, char** argv)
{
        glutInit(&argc, argv);
        glInit();
        trickCommInit();
        glutIdleFunc(move_ball);
        glutKeyboardFunc(keyboard);
        glutMainLoop();
        return 0;
}
Exemple #26
0
void QGLWidget::resizeEvent( QResizeEvent * )
{
    if ( !isValid() )
        return ;
    makeCurrent();
    if ( !glcx->initialized() )
        glInit();
    resizeGL( width(), height() );
if ( olcx ) {} //TODO:reimplement!!!
}
 RenderTarget::RenderTarget( int width, int height, GLenum internalFormat, GLenum format, GLenum type, int numSamples, bool mipmaps ){
   pTex = new BlankTexture( width, height, internalFormat, format, type, numSamples, mipmaps );
   pDepth = new BlankTexture( width, height, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_FLOAT, numSamples, false );
   this->width = width;
   this->height = height;
   this->numSamples = numSamples;
   this->mipmaps = mipmaps;
   glGenFramebuffers( 1, &fbo );
   glInit();
 }
void ElevatorSimRenderWindow::draw() {
   SimulationState& simState = SimulationState::acquire();

   if(!valid()) {
      /* init, this code only gets executed the first time draw() is called */

      simState.lockBASM(); /* CRITICAL SECTION START */
      simState.initRenderObjs();
      simState.unlockBASM(); /* CRITICAL SECTION STOP */

      glInit();
      setViewport();
   }

   /* draw */
   glClearColor(0.0, 0.0, 0.0, 0.0);
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();

   /* TODO: make these constants somewhere */
   gluPerspective(45.0f, (GLfloat)w()/(GLfloat)h(), 0.1f, 500.0f);

   simState.lockBASM(); /* CRITICAL SECTION START */
   simState.getCameraManager().render();

   glMatrixMode(GL_MODELVIEW);
   glEnable(GL_LIGHTING);
   glEnable(GL_LIGHT0);

   simState.getBuilding().render();

   int curFPS = simState.getTimeManager().getFPS();
   int curTotalFrames = simState.getTimeManager().getTotalFrames();

   SimulationState::StateKind currentSimState = simState.getStateUnsafe();
   simState.unlockBASM(); /* CRITICAL SECTION STOP */


   if(currentSimState == SimulationState::SIMULATION_RUNNING &&
            m_bRenderFPS) {
      drawFPS(curFPS, curTotalFrames);
   }

   /* glTranslatef(0.f, 3.f, 3.f);
    * glCallList(cRenderObjs::OBJ_HUMAN); */

   GLenum err = glGetError();
   if ( err != GL_NO_ERROR ) {
      std::stringstream dbgSS;
      dbgSS << "GLGETERROR= " << (int) err << std::endl;
      LOG_ERROR( Logger::SUB_RENDER, sstreamToBuffer(dbgSS) );
   }
}
Exemple #29
0
int main(int argc, char ** argv)
{
	XnStatus rc = XN_STATUS_OK;

	// Initialize OpenNI
	rc = g_Context.InitFromXmlFile(SAMPLE_XML_PATH);
	CHECK_RC(rc, "InitFromXmlFile");

	rc = g_Context.FindExistingNode(XN_NODE_TYPE_DEPTH, g_DepthGenerator);
	CHECK_RC(rc, "Find depth generator");
	rc = g_Context.FindExistingNode(XN_NODE_TYPE_HANDS, g_HandsGenerator);
	CHECK_RC(rc, "Find hands generator");

	// Create NITE objects
	g_pSessionManager = new XnVSessionManager;
	rc = g_pSessionManager->Initialize(&g_Context, "Click,Wave", "RaiseHand");
	CHECK_RC(rc, "SessionManager::Initialize");

	g_pSessionManager->RegisterSession(NULL, SessionStarting, SessionEnding, NULL);

	g_pDrawer = new XnVPointDrawer(20, g_DepthGenerator);
	g_pFlowRouter = new XnVFlowRouter;
	g_pFlowRouter->SetActive(g_pDrawer);
	g_pSessionManager->AddListener(g_pFlowRouter);

	g_pDrawer->RegisterNoPoints(NULL, NoHands);
	g_pDrawer->SetDepthMap(g_bDrawDepthMap);

	// init & register circle control
	XnVCircleDetector circle;
	circle.RegisterCircle(NULL, OnCircleCB);
	circle.RegisterNoCircle(NULL, OnNoCircleCB);
	g_pSessionManager->AddListener(&circle);

	// init & register swipe control
	XnVSwipeDetector swipe;
	swipe.RegisterSwipeUp(NULL, OnSwipeUpCB);
	swipe.RegisterSwipeDown(NULL, OnSwipeDownCB);
	swipe.RegisterSwipeLeft(NULL, OnSwipeLeftCB);
	swipe.RegisterSwipeRight(NULL, OnSwipeRightCB);
	g_pSessionManager->AddListener(&swipe);

	// init & register wave control
	XnVWaveDetector wave;
	wave.RegisterWave(NULL, OnWaveCB);
	g_pSessionManager->AddListener(&wave);

	// Initialization done. Start generating
	rc = g_Context.StartGeneratingAll();
	CHECK_RC(rc, "StartGenerating");

	// Mainloop
	glInit(&argc, argv);
	glutMainLoop();
}
void QGLWidget::resizeEvent(QResizeEvent *)
{
    Q_D(QGLWidget);
    if (!isValid())
        return;
    makeCurrent();
    if (!d->glcx->initialized())
        glInit();
    resizeGL(width(), height());
    //handle overlay
}