text: /*****************************************************************************
  *                                                                            *
  *  OpenNI 2.x Alpha                                                          *
  *  Copyright (C) 2012 PrimeSense Ltd.                                        *
  *                                                                            *
  *  This file is part of OpenNI.                                              *
  *                                                                            *
  *  Licensed under the Apache License, Version 2.0 (the "License");           *
  *  you may not use this file except in compliance with the License.          *
  *  You may obtain a copy of the License at                                   *
  *                                                                            *
  *      http://www.apache.org/licenses/LICENSE-2.0                            *
  *                                                                            *
  *  Unless required by applicable law or agreed to in writing, software       *
  *  distributed under the License is distributed on an "AS IS" BASIS,         *
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  *
  *  See the License for the specific language governing permissions and       *
  *  limitations under the License.                                            *
  *                                                                            *
  *****************************************************************************/
  #ifndef _ONI_SAMPLE_VIEWER_H_
  #define _ONI_SAMPLE_VIEWER_H_
  
  #include <OpenNI.h>
  
  #define MAX_DEPTH 10000
  
  enum DisplayModes
  {
  	DISPLAY_MODE_OVERLAY,
  	DISPLAY_MODE_DEPTH,
  	DISPLAY_MODE_IMAGE
  };
  
  class SampleViewer
  {
  public:
  	SampleViewer(const char* strSampleName, openni::Device& device, openni::VideoStream& depth, openni::VideoStream& color);
  	virtual ~SampleViewer();
  
  	virtual openni::Status init(int argc, char **argv);
  	virtual openni::Status run();	//Does not return
  
  protected:
  	virtual void display();
  	virtual void displayPostDraw(){};	// Overload to draw over the screen image
  
  	virtual void onKey(unsigned char key, int x, int y);
  
  	virtual openni::Status initOpenGL(int argc, char **argv);
  	void initOpenGLHooks();
  
  	openni::VideoFrameRef		m_depthFrame;
  	openni::VideoFrameRef		m_colorFrame;
  
  	openni::Device&			m_device;
  	openni::VideoStream&			m_depthStream;
  	openni::VideoStream&			m_colorStream;
  	openni::VideoStream**		m_streams;
  
  private:
  	SampleViewer(const SampleViewer&);
  	SampleViewer& operator=(SampleViewer&);
  
  	static SampleViewer* ms_self;
  	static void glutIdle();
  	static void glutDisplay();
  	static void glutKeyboard(unsigned char key, int x, int y);
  
  	float			m_pDepthHist[MAX_DEPTH];
  	char			m_strSampleName[ONI_MAX_STR];
  	unsigned int		m_nTexMapX;
  	unsigned int		m_nTexMapY;
  	DisplayModes		m_eViewState;
  	openni::RGB888Pixel*	m_pTexMap;
  	int			m_width;
  	int			m_height;
  };
  
  
  #endif // _ONI_SAMPLE_VIEWER_H_
  