Example usage for android.opengl GLSurfaceView RENDERMODE_CONTINUOUSLY

List of usage examples for android.opengl GLSurfaceView RENDERMODE_CONTINUOUSLY

Introduction

In this page you can find the example usage for android.opengl GLSurfaceView RENDERMODE_CONTINUOUSLY.

Prototype

int RENDERMODE_CONTINUOUSLY

To view the source code for android.opengl GLSurfaceView RENDERMODE_CONTINUOUSLY.

Click Source Link

Document

The renderer is called continuously to re-render the scene.

Usage

From source file:com.projecttango.examples.java.meshbuilder.MeshBuilderActivity.java

@Override
protected void onStart() {
    super.onStart();
    mSurfaceView.onResume();//from  w w w.j  a  va  2 s .c om

    // Set render mode to RENDERMODE_CONTINUOUSLY to force getting onDraw callbacks until
    // the Tango Service is properly set up and we start getting onFrameAvailable callbacks.
    mSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
    // Check and request camera permission at run time.
    if (checkAndRequestPermissions()) {
        bindTangoService();
    }
}

From source file:com.projecttango.examples.java.occlusion.OcclusionActivity.java

@Override
protected void onStart() {
    super.onStart();
    mSurfaceView.onResume();/*  w ww . j  a v  a 2 s  .  c  o  m*/

    // Set render mode to RENDERMODE_CONTINUOUSLY to force getting onDraw callbacks until
    // the Tango service is properly set up and we start getting onFrameAvailable callbacks.
    mSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
    // Check and request camera permission at run time.
    if (checkAndRequestPermissions()) {
        bindTangoService();
    }
}

From source file:com.projecttango.examples.java.augmentedreality.AugmentedRealityActivity.java

@Override
protected void onStart() {
    super.onStart();

    // Set render mode to RENDERMODE_CONTINUOUSLY to force getting onDraw callbacks until
    // the Tango service is properly set up and we start getting onFrameAvailable callbacks.
    mSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
    // Check and request camera permission at run time.
    if (checkAndRequestPermissions()) {
        bindTangoService();// w w  w. j  a va  2 s.  co  m
    }
}

From source file:com.example.aaron.test.MyGLSurfaceView.java

public MyGLSurfaceView(Context context, float f[], turtle turtleList[]) {
    super(context);
    context1 = context;/*from  www .j a  va 2 s . co m*/
    v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    vor = new Voronoi(.001);
    DisplayMetrics metrics = new DisplayMetrics();
    ((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(metrics);
    width1 = metrics.widthPixels;
    height1 = metrics.heightPixels;
    mapLeft = (width1 - 100) / height1;
    mapTop = (height1 - 5) / height1;
    mapBottom = -(height1 - 5) / height1;

    poseData = f;
    // Create an OpenGL ES 2.0 context.
    setEGLContextClientVersion(2);
    for (int i = 0; i < maxBots; i++) {
        tList[i] = new turtle();
        state[i] = 0;
    }

    // Set the Renderer for drawing on the GLSurfaceView
    mRenderer = new MyGLRenderer(context, f, tList, width1, height1);
    //float posTemp[]=f;
    setEGLConfigChooser(new MultisampleConfigChooser());
    setRenderer(mRenderer);

    // Render the view only when there is a change in the drawing data
    setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);

}

From source file:com.projecttango.examples.java.openglar.OpenGlAugmentedRealityActivity.java

@Override
protected void onStart() {
    super.onStart();
    mSurfaceView.onResume();//from   www .  j  ava2s  .  c o m

    // Set render mode to RENDERMODE_CONTINUOUSLY to force getting onDraw callbacks until
    // the Tango service is properly set-up and we start getting onFrameAvailable callbacks.
    mSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
    // Check and request camera permission at run time.
    if (checkAndRequestPermissions()) {
        bindTangoService();
    }
}

From source file:com.projecttango.examples.java.greenscreen.GreenScreenActivity.java

@Override
protected void onStart() {
    super.onStart();
    mSurfaceView.onResume();//from ww w .jav a 2  s. c om

    // Set render mode to RENDERMODE_CONTINUOUSLY to force getting onDraw callbacks until
    // the Tango Service is properly set up and we start getting onFrameAvailable callbacks.
    mSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
    // Check and request permissions at run time.
    if (hasPermissions()) {
        bindTangoService();
    } else {
        requestPermissions();
    }
}

From source file:jp.co.cyberagent.android.gpuimage.sample.activity.ActivityCamera.java

License:asdf

private void takePicture() {
    // TODO get a size that is about the size of the screen
    Camera.Parameters params = mCameraLoader.mCameraInstance.getParameters();
    params.setPictureSize(1280, 960);//from   www  . java  2s.co m
    params.setRotation(90);
    mCameraLoader.mCameraInstance.setParameters(params);
    for (Camera.Size size2 : mCameraLoader.mCameraInstance.getParameters().getSupportedPictureSizes()) {
        Log.i("ASDF", "Supported: " + size2.width + "x" + size2.height);
    }
    mCameraLoader.mCameraInstance.takePicture(null, null, new Camera.PictureCallback() {

        @Override
        public void onPictureTaken(byte[] data, final Camera camera) {

            final File pictureFile = getOutputMediaFile(MEDIA_TYPE_IMAGE);
            if (pictureFile == null) {
                Log.d("ASDF", "Error creating media file, check storage permissions");
                return;
            }

            try {
                FileOutputStream fos = new FileOutputStream(pictureFile);
                fos.write(data);
                fos.close();
            } catch (FileNotFoundException e) {
                Log.d("ASDF", "File not found: " + e.getMessage());
            } catch (IOException e) {
                Log.d("ASDF", "Error accessing file: " + e.getMessage());
            }

            data = null;
            Bitmap bitmap = BitmapFactory.decodeFile(pictureFile.getAbsolutePath());
            // mGPUImage.setImage(bitmap);
            final GLSurfaceView view = (GLSurfaceView) findViewById(R.id.surfaceView);
            view.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
            mGPUImage.saveToPictures(bitmap, "GPUImage", System.currentTimeMillis() + ".jpg",
                    new OnPictureSavedListener() {

                        @Override
                        public void onPictureSaved(final Uri uri) {
                            pictureFile.delete();
                            camera.startPreview();
                            view.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
                        }
                    });
        }
    });
}

From source file:com.aincc.libtest.activity.flip.FlipViewGroup.java

/**
 * Surface  <br>/*from w  w  w  .  j  ava 2s . co  m*/
 *    ? .
 * 
 * @since 1.0.0
 */
private void setupSurfaceView() {
    Logger.v("FlipViewGroup::setupSurfaceView()");
    surfaceView = new GLSurfaceView(getContext());
    renderer = new FlipRenderer(this);
    surfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
    surfaceView.setZOrderOnTop(true);
    surfaceView.setRenderer(renderer);
    // surfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT); // ?  
    surfaceView.getHolder().setFormat(PixelFormat.OPAQUE);
    surfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
    renderer.getCards().setFlipViewGroup(this);
    addView(surfaceView);
}

From source file:com.pseudosurface.levels.template.SimulatorActivity.java

public MyGLSurfaceView(Context context, SimulatorActivity simulation) {
    super(context);

    gestureDetector = new GestureDetector(context, new GestureListener());

    this.simulation = simulation;

    // Create an OpenGL ES 2.0 context.
    setEGLContextClientVersion(2);/*from   ww w  .  j a va 2s . co  m*/

    // Set the Renderer for drawing on the GLSurfaceView
    mRenderer = simulation.getRenderer();

    setRenderer(mRenderer);

    setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
}

From source file:com.almalence.opencam.ApplicationScreen.java

public void glSetRenderingMode(final int renderMode) {
    if (renderMode != GLSurfaceView.RENDERMODE_WHEN_DIRTY
            && renderMode != GLSurfaceView.RENDERMODE_CONTINUOUSLY) {
        throw new IllegalArgumentException();
    }/*  w  ww.ja v a2s  . com*/

    final GLSurfaceView surfaceView = glView;
    if (surfaceView != null) {
        surfaceView.setRenderMode(renderMode);
    }
}