visageSDK
TrackerRenderer.java
1 package com.visagetechnologies.visagetrackerdemo;
2 
3 import javax.microedition.khronos.egl.EGLConfig;
4 import javax.microedition.khronos.opengles.GL10;
5 import javax.microedition.khronos.opengles.GL11;
6 import javax.microedition.khronos.opengles.GL11Ext;
7 import android.content.Context;
8 import android.graphics.Bitmap;
9 import android.graphics.Canvas;
10 import android.graphics.Point;
11 import android.graphics.drawable.Drawable;
12 import android.opengl.GLSurfaceView;
13 import android.opengl.GLUtils;
14 import android.util.Log;
15 import android.view.Display;
16 import android.view.WindowManager;
17 
20 public class TrackerRenderer implements GLSurfaceView.Renderer
21 {
22  int _width;
23  int _height;
24  int[] textures = new int[3];
25  Context _context;
26 
31  TrackerRenderer(Context context)
32  {
33  _context = context;
34  }
35 
41  public void onDrawFrame(GL10 gl)
42  {
43  // gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
44 
45  boolean status = displayTrackingStatus(_width, _height);
46 
47  gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
48  gl.glEnable(GL10.GL_BLEND);
49  }
50 
54  public void onSurfaceChanged(GL10 gl, int width, int height)
55  {
56  _width = width;
57  _height = height;
58 
59  }
60 
61  public void onSurfaceCreated(GL10 gl, EGLConfig config)
62  {
63  WindowManager wm = (WindowManager) _context.getSystemService(Context.WINDOW_SERVICE);
64  Display display = wm.getDefaultDisplay();
65  Point size = new Point();
66  display.getSize(size);
67  }
68 
69 
75  public native boolean displayTrackingStatus(int width, int height);
76 
77  public native void DisplayInstructions();
78 
79  static
80  {
81  System.loadLibrary("VisageVision");
82  System.loadLibrary("VisageWrapper");
83  }
84 }
void onDrawFrame(GL10 gl)
Implementation of onDrawFrame method provided by GLSurfaceView.Renderer interface.
TrackerRenderer class provides implementation of rendering functions required for displaying tracking...
void onSurfaceChanged(GL10 gl, int width, int height)
Implementation of surfaceChanged method provided by SurfaceHolder.Callback class. ...
native boolean displayTrackingStatus(int width, int height)
Interface to native method used to draw current frame analyzed by tracker and face model generated fr...