Java Code Examples for android.opengl.GLSurfaceView#setDebugFlags()

The following examples show how to use android.opengl.GLSurfaceView#setDebugFlags() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CameraCapturerActivity.java    From media-for-mobile with Apache License 2.0 6 votes vote down vote up
private void createPreview() {
    surfaceView = new GLSurfaceView(getApplicationContext());

    surfaceView.setDebugFlags(GLSurfaceView.DEBUG_CHECK_GL_ERROR);

    ((RelativeLayout) findViewById(R.id.camera_layout)).addView(surfaceView, 0);

    preview = capture.createPreview(surfaceView, camera);
    preview.setFillMode(fillMode);

    if (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        capture.setOrientation(90);
    } else if (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
        capture.setOrientation(0);
    }

    preview.start();
}
 
Example 2
Source File: GPUCameraRecorder.java    From GPUVideo-android with MIT License 4 votes vote down vote up
GPUCameraRecorder(
        CameraRecordListener cameraRecordListener,
        final GLSurfaceView glSurfaceView,
        final int fileWidth,
        final int fileHeight,
        final int cameraWidth,
        final int cameraHeight,
        final LensFacing lensFacing,
        final boolean flipHorizontal,
        final boolean flipVertical,
        final boolean mute,
        final CameraManager cameraManager,
        final boolean isLandscapeDevice,
        final int degrees,
        final boolean recordNoFilter
) {


    this.cameraRecordListener = cameraRecordListener;

    glSurfaceView.setDebugFlags(GLSurfaceView.DEBUG_CHECK_GL_ERROR);
    this.glSurfaceView = glSurfaceView;

    this.fileWidth = fileWidth;
    this.fileHeight = fileHeight;
    this.cameraWidth = cameraWidth;
    this.cameraHeight = cameraHeight;
    this.lensFacing = lensFacing;
    this.flipHorizontal = flipHorizontal;
    this.flipVertical = flipVertical;
    this.mute = mute;
    this.cameraManager = cameraManager;
    this.isLandscapeDevice = isLandscapeDevice;
    this.degrees = degrees;
    this.recordNoFilter = recordNoFilter;

    // create preview Renderer
    if (null == glPreviewRenderer) {
        glPreviewRenderer = new GlPreviewRenderer(glSurfaceView);
    }

    glPreviewRenderer.setSurfaceCreateListener(new GlPreviewRenderer.SurfaceCreateListener() {
        @Override
        public void onCreated(SurfaceTexture surfaceTexture) {
            startPreview(surfaceTexture);
        }
    });
}
 
Example 3
Source File: CameraRecorder.java    From CameraRecorder-android with MIT License 4 votes vote down vote up
CameraRecorder(
        CameraRecordListener cameraRecordListener,
        final GLSurfaceView glSurfaceView,
        final int fileWidth,
        final int fileHeight,
        final int cameraWidth,
        final int cameraHeight,
        final LensFacing lensFacing,
        final boolean flipHorizontal,
        final boolean flipVertical,
        final boolean mute,
        final CameraManager cameraManager,
        final boolean isLandscapeDevice,
        final int degrees,
        final boolean recordNoFilter
) {


    this.cameraRecordListener = cameraRecordListener;

    glSurfaceView.setDebugFlags(GLSurfaceView.DEBUG_CHECK_GL_ERROR);
    this.glSurfaceView = glSurfaceView;

    this.fileWidth = fileWidth;
    this.fileHeight = fileHeight;
    this.cameraWidth = cameraWidth;
    this.cameraHeight = cameraHeight;
    this.lensFacing = lensFacing;
    this.flipHorizontal = flipHorizontal;
    this.flipVertical = flipVertical;
    this.mute = mute;
    this.cameraManager = cameraManager;
    this.isLandscapeDevice = isLandscapeDevice;
    this.degrees = degrees;
    this.recordNoFilter = recordNoFilter;

    // create preview Renderer
    if (null == glPreviewRenderer) {
        glPreviewRenderer = new GlPreviewRenderer(glSurfaceView);
    }

    glPreviewRenderer.setSurfaceCreateListener(new GlPreviewRenderer.SurfaceCreateListener() {
        @Override
        public void onCreated(SurfaceTexture surfaceTexture) {
            startPreview(surfaceTexture);
        }
    });
}
 
Example 4
Source File: PointCloudActivity.java    From tango with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_jpoint_cloud);
    setTitle(R.string.app_name);

    mPoseTextView = (TextView) findViewById(R.id.pose);
    mQuatTextView = (TextView) findViewById(R.id.quat);
    mPoseCountTextView = (TextView) findViewById(R.id.posecount);
    mDeltaTextView = (TextView) findViewById(R.id.deltatime);
    mTangoEventTextView = (TextView) findViewById(R.id.tangoevent);
    mPoseStatusTextView = (TextView) findViewById(R.id.status);
    mPointCountTextView = (TextView) findViewById(R.id.pointCount);
    mTangoServiceVersionTextView = (TextView) findViewById(R.id.version);
    mApplicationVersionTextView = (TextView) findViewById(R.id.appversion);
    mAverageZTextView = (TextView) findViewById(R.id.averageZ);
    mFrequencyTextView = (TextView) findViewById(R.id.frameDelta);

    mSaveButton = (Button) findViewById(R.id.saveButton);
    mSaveButton.setOnClickListener(this);
    mFirstPersonButton = (Button) findViewById(R.id.first_person_button);
    mFirstPersonButton.setOnClickListener(this);
    mThirdPersonButton = (Button) findViewById(R.id.third_person_button);
    mThirdPersonButton.setOnClickListener(this);
    mTopDownButton = (Button) findViewById(R.id.top_down_button);
    mTopDownButton.setOnClickListener(this);

    mGLView = (GLSurfaceView) findViewById(R.id.gl_surface_view);
    mGLView.setEGLContextClientVersion(2);

    mTango = new Tango(this);
    mConfig = mTango.getConfig(TangoConfig.CONFIG_TYPE_CURRENT);
    // tangoCameraPreview = (TangoCameraPreview) findViewById(R.id.cameraView);

    int maxDepthPoints = mConfig.getInt("max_point_cloud_elements");
    mRenderer = new PCRenderer(maxDepthPoints);
    mGLView.setRenderer(mRenderer);

    mConfig.putBoolean(TangoConfig.KEY_BOOLEAN_DEPTH, true);
    mGLView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);

    PackageInfo packageInfo;
    try {
        packageInfo = this.getPackageManager().getPackageInfo(
                this.getPackageName(), 0);
        mApplicationVersionTextView.setText(packageInfo.versionName);
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    // Display the version of Tango Service
    mServiceVersion = mConfig.getString("tango_service_library_version");
    mTangoServiceVersionTextView.setText(mServiceVersion);
    mIsTangoServiceConnected = false;

    // Set up OpenGL ES surface
    mCamView = new GLSurfaceView(this);
    mCamView.setEGLContextClientVersion(2);
    mCamView.setDebugFlags(GLSurfaceView.DEBUG_CHECK_GL_ERROR);
    mCamView.setRenderer(renderer_ = new FrameRenderer(this));
    mCamView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
    mCamView.setOnClickListener(this);
    FrameLayout placeholder = (FrameLayout)findViewById(R.id.cameraFrame);
    placeholder.addView(mCamView);
    cameraTextures_ = new HashMap<>();
}