@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create_task_find_and_answer_addtoscene_cardboard); ctx = this; cardboardView = (CardboardView) findViewById(R.id.cardboardView_findAndAnswerCreateTask); cardboardView.setRestoreGLStateEnabled(false); cardboardView.setRenderer(this); setCardboardView(cardboardView); mCamera = new float[16]; mView = new float[16]; mModelCube = new float[16]; headView = new float[16]; cameraFloat = new float[16]; modelView = new float[16]; modelViewProjection = new float[16]; color = new float[] {1.0f, 0.0f, 0.0f, 1.0f}; mVibrator = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE); }
public void reset() { // TODO Auto-generated method stub if (sketch.getKind() == PApplet.CARDBOARD) { CardboardView v = (CardboardView) surface; v.resetHeadTracker(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cardboardui); CardboardView cardboardView = (CardboardView) findViewById(R.id.cardboard_view); cardboardView.setRenderer(this); setCardboardView(cardboardView); setConvertTapIntoTrigger(true); }
// part of SurfaceHolder.Callback @Override public void surfaceCreated(SurfaceHolder holder) { super.surfaceCreated(holder); if (PApplet.DEBUG) { System.out.println("surfaceCreated()"); } }
/** * Sets the view to our CardboardView and initializes the transformation matrices we will use to * render our scene. * * @param savedInstanceState */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.common_ui); cardboardView = (CardboardView) findViewById(R.id.cardboard_view); cardboardView.setRenderer(this); setCardboardView(cardboardView); mCamera = new float[16]; mView = new float[16]; mOverlayView = (CardboardOverlayView) findViewById(R.id.overlay); mOverlayView.show3DToast("Not every day is Purim."); }
@Override public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { super.surfaceChanged(holder, format, w, h); if (PApplet.DEBUG) { System.out.println("SketchSurfaceView3D.surfaceChanged() " + w + " " + h); } sketch.surfaceChanged(); // width = w; // height = h; // g.setSize(w, h); // No need to call g.setSize(width, height) b/c super.surfaceChanged() // will trigger onSurfaceChanged in the renderer, which calls setSize(). // -- apparently not true? (100110) }
// part of SurfaceHolder.Callback @Override public void surfaceDestroyed(SurfaceHolder holder) { super.surfaceDestroyed(holder); if (PApplet.DEBUG) { System.out.println("surfaceDestroyed()"); } /* // TODO: Check how to make sure of calling g3.dispose() when this call to // surfaceDestoryed corresponds to the sketch being shut down instead of just // taken to the background. // For instance, something like this would be ok? // The sketch is being stopped, so we dispose the resources. if (!paused) { g3.dispose(); } */ }
/** * Sets the view to our CardboardView and initializes the transformation matrices we will use to * render our scene. * * @param savedInstanceState */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.common_ui); cardboardView = (CardboardView) findViewById(R.id.cardboard_view); cardboardView.setRenderer(this); setCardboardView(cardboardView); // mModelCube = new float[16]; mCamera = new float[16]; mView = new float[16]; // mModelViewProjection = new float[16]; // mModelView = new float[16]; // mModelFloor = new float[16]; // mHeadView = new float[16]; // mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); // // mOverlayView = (CardboardOverlayView) findViewById(R.id.overlay); mOverlayView.show3DToast("Pull the magnet when you find an object."); }
@Override public boolean onTouchEvent(MotionEvent event) { super.onTouchEvent(event); // for Cardboard view touch events return sketch.surfaceTouchEvent(event); }