GLRsSurfaceView.java
Go to the documentation of this file.
1 package com.intel.realsense.librealsense;
2 
3 import android.content.Context;
4 import android.graphics.Rect;
5 import android.opengl.GLSurfaceView;
6 import android.util.AttributeSet;
7 import android.util.Pair;
8 import android.view.MotionEvent;
9 
10 import java.util.Map;
11 
12 public class GLRsSurfaceView extends GLSurfaceView implements AutoCloseable{
13 
14  private final GLRenderer mRenderer;
15  private float mPreviousX = 0;
16  private float mPreviousY = 0;
17 
18  public GLRsSurfaceView(Context context) {
19  super(context);
20  mRenderer = new GLRenderer();
21  setRenderer(mRenderer);
22  }
23 
24  public GLRsSurfaceView(Context context, AttributeSet attrs) {
25  super(context, attrs);
26  mRenderer = new GLRenderer();
27  setRenderer(mRenderer);
28  }
29 
30  public Map<Integer, Pair<String,Rect>> getRectangles() {
31  return mRenderer.getRectangles();
32  }
33 
34  public void upload(FrameSet frames) {
35  mRenderer.upload(frames);
36  }
37 
38  public void upload(Frame frame) {
39  mRenderer.upload(frame);
40  }
41 
42  public void clear() {
43  mRenderer.clear();
44  }
45 
46  @Override
47  public boolean onTouchEvent(MotionEvent e) {
48  float x = e.getX();
49  float y = e.getY();
50 
51  switch (e.getAction()) {
52  case MotionEvent.ACTION_MOVE:
53 
54  float dx = x - mPreviousX;
55  float dy = y - mPreviousY;
56  mRenderer.onTouchEvent(dx, dy);
57  }
58 
59  mPreviousX = x;
60  mPreviousY = y;
61  return true;
62  }
63 
64  public void showPointcloud(boolean showPoints) {
65  mRenderer.showPointcloud(showPoints);
66  }
67 
68  @Override
69  public void close() {
70  if(mRenderer != null)
71  mRenderer.close();
72  }
73 }
GLint y
uvc_xu_option< int > super
Definition: l500-options.h:32
e
Definition: rmse.py:177
Map< Integer, Pair< String, Rect > > getRectangles()
GLdouble x
Map< Integer, Pair< String, Rect > > getRectangles()
Definition: GLRenderer.java:33
GLRsSurfaceView(Context context, AttributeSet attrs)


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:16