00001 /* 00002 * Copyright 2014 Google Inc. All Rights Reserved. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 package com.introlab.rtabmap; 00018 00019 import android.app.ProgressDialog; 00020 import android.opengl.GLSurfaceView; 00021 00022 import javax.microedition.khronos.egl.EGLConfig; 00023 import javax.microedition.khronos.opengles.GL10; 00024 00025 // Renderer renders graphic content. This includes the point cloud, 00026 // ground grid, camera frustum, camera axis, and trajectory based on the Tango 00027 // device's pose. 00028 public class Renderer implements GLSurfaceView.Renderer { 00029 00030 private ProgressDialog mProgressDialog; 00031 00032 public void setProgressDialog(ProgressDialog progressDialog) 00033 { 00034 mProgressDialog = progressDialog; 00035 } 00036 00037 // Render loop of the Gl context. 00038 public void onDrawFrame(GL10 gl) { 00039 int value = RTABMapLib.render(); 00040 if(value == 1 && mProgressDialog != null) 00041 { 00042 mProgressDialog.dismiss(); 00043 } 00044 } 00045 00046 // Called when the surface size changes. 00047 public void onSurfaceChanged(GL10 gl, int width, int height) { 00048 RTABMapLib.setupGraphic(width, height); 00049 } 00050 00051 // Called when the surface is created or recreated. 00052 public void onSurfaceCreated(GL10 gl, EGLConfig config) { 00053 RTABMapLib.initGlContent(); 00054 } 00055 }