ArViewer  Android Version
Arvos - Augmented reality viewer open source
 All Classes Namespaces Files Functions Variables
ArvosGLSurfaceView.java
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013, Peter Graf
3 
4  This file is part of Arvos - AR Viewer Open Source for Android.
5  Arvos is free software.
6 
7  This program is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 
20  For more information on the AR Viewer Open Source or Peter Graf,
21  please see: http://www.mission-base.com/.
22  */
23 
24 package com.mission_base.arviewer_android.viewer.opengl;
25 
26 import android.content.Context;
27 import android.graphics.PixelFormat;
28 import android.opengl.GLSurfaceView;
29 import android.view.MotionEvent;
30 
31 import com.mission_base.arviewer_android.Arvos;
32 
39 public class ArvosGLSurfaceView extends GLSurfaceView
40 {
41  private Arvos mInstance;
42 
43  public ArvosGLSurfaceView(Context context)
44  {
45  super(context);
46 
47  mInstance = Arvos.getInstance();
48  setZOrderMediaOverlay(true);
49  setEGLConfigChooser(8, 8, 8, 8, 16, 0);
50  setRenderer(new ArvosRenderer());
51  getHolder().setFormat(PixelFormat.TRANSLUCENT);
52  }
53 
54  @Override
55  public boolean onTouchEvent(MotionEvent e)
56  {
57  float x = e.getX();
58  float y = e.getY();
59 
60  int action = e.getAction();
61  if (action != MotionEvent.ACTION_DOWN)
62  {
63  return true;
64  }
65 
66  mInstance.mHandleTouch = true;
67  ArvosTouchHandler arvosTouchHandler = new ArvosTouchHandler(x, y);
68  arvosTouchHandler.start();
69 
70  return true;
71  }
72 
73 }