GazeTracker
GazeRenderer.h
1 #include "visageVision.h"
2 #include "glut.h"
3 #include "Window.h"
4 
5 using namespace VisageSDK;
6 
7 /** Simple OpenGL graphics renderer.
8 * Contains methods to draw screen space gaze postion in calibration or estimation phase, as well as video stream from camera and tracking results.
9 */
11 {
12 public:
13  GazeRenderer(void);
14  ~GazeRenderer(void);
15 
16  void SetDrawWindow(Window* window);
17 
18  /** Method called to redraw the gaze tracking and face tracking results in display window.
19  * In calibration phase it draws the latest calibration point, video frame from the camera and the latest tracking results.
20  *
21  * In estimation phase it draws the latest estimated screen space gaze position, video frame from the camera and the latest tracking results.
22  *
23  * Additionally, it displays instruction messages.
24  * Drawing is done from the main application thread.
25  */
26  void Redraw(ScreenSpaceGazeData* gazeData, FaceData* data, VsImage* image, int trackingStatus);
27 
28  void RecalibStarted(int trackingStatus);
29 
30  bool inRecalibSequence;
31  bool recalibSequenceEnd;
32 
33  void DrawPoint(float x, float y, int r, int g, int b, int size);
34  void DrawImage(VsImage* image);
35  void DrawTrackingData(FaceData* data, VsImage* frame);
36  void DisplayText(char* displayText, float x, float y);
37  void Clear();
38  void Swap();
39 
40 private:
41  Window* window;
42  int width, height;
43  GLuint frameTexId;
44  int glHeight, glWidth;
45  float xTexCoord, yTexCoord;
46  float glMousePosX, glMousePosY;
47  long timestamp;
48  long recalibTimestamp;
49  bool setRenderingContext;
50 
51  void DisplayGazeData(ScreenSpaceGazeData calibData);
52 
53  void initFrameTexture(VsImage* image);
54  void setFrameTexture(VsImage* image);
55  void DrawImage();
56  void SetupFrustum();
57  void drawFaceFeatures(FDP* featurePoints2D);
58  void drawGazeDirection(const float* gazeDirection ,FDP* featurePoints3D);
59  void drawPoints2D(int *points, int num, int drawType, FDP* featurePoints2D);
60  void SetupFrustum(int width, int height, int focus);
61  bool eyesState;
62 
63 };
Simple OpenGL graphics renderer.
Definition: GazeRenderer.h:10