当前位置: 首页>>代码示例>>Java>>正文


Java GLSurfaceView.setRenderer方法代码示例

本文整理汇总了Java中android.opengl.GLSurfaceView.setRenderer方法的典型用法代码示例。如果您正苦于以下问题:Java GLSurfaceView.setRenderer方法的具体用法?Java GLSurfaceView.setRenderer怎么用?Java GLSurfaceView.setRenderer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.opengl.GLSurfaceView的用法示例。


在下文中一共展示了GLSurfaceView.setRenderer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: VrShellImpl

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@UsedByReflection("VrShellDelegate.java")
public VrShellImpl(Activity activity) {
    super(activity);
    mActivity = activity;
    mContentViewCoreContainer = new FrameLayout(getContext()) {
        @Override
        public boolean dispatchTouchEvent(MotionEvent event) {
            return true;
        }
    };
    addView(mContentViewCoreContainer, 0, new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.MATCH_PARENT));
    mGlSurfaceView = new GLSurfaceView(getContext());
    mGlSurfaceView.setEGLContextClientVersion(2);
    mGlSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 0, 0);
    mGlSurfaceView.setPreserveEGLContextOnPause(true);
    mGlSurfaceView.setRenderer(this);
    setPresentationView(mGlSurfaceView);

    if (setAsyncReprojectionEnabled(true)) {
        AndroidCompat.setSustainedPerformanceMode(mActivity, true);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:25,代码来源:VrShellImpl.java

示例2: onCreate

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mGLSurfaceView = new GLSurfaceView(this);

    // Check if the system supports OpenGL ES 2.0.
    final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

    if (supportsEs2) {
        // Request an OpenGL ES 2.0 compatible context.
        mGLSurfaceView.setEGLContextClientVersion(2);

        // Set the renderer to our demo renderer, defined below.
        mGLSurfaceView.setRenderer(new LessonOneRenderer());
    } else {
        // This is where you could create an OpenGL ES 1.x compatible
        // renderer if you wanted to support both ES 1 and ES 2.
        return;
    }

    setContentView(mGLSurfaceView);
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:26,代码来源:OpenGLActivity.java

示例3: onCreate

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mGLSurfaceView = new GLSurfaceView(this);

        // Check if the system support OpenGL ES 2.0
        final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
        final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

        if (supportsEs2) {
            // Request an OpenGL ES 2.0 compatible context.
            mGLSurfaceView.setEGLContextClientVersion(2);

            // Set the renderer to out demo renderer, define below
//            mGLSurfaceView.setRenderer(new LessonThreeRenderer());
            mGLSurfaceView.setRenderer(new NativeThreeRenderer());
        } else {
            // This is where you could create an OpenGL ES 1.x compatible
            // renderer if you wanted to support both ES 1 and ES 2
            return;
        }
        setContentView(mGLSurfaceView);
    }
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:26,代码来源:LessonThreeActivity.java

示例4: onCreate

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mGLSurfaceView = new GLSurfaceView(this);

        // Check if the system support OpenGL ES 2.0
        final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
        final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

        if (supportsEs2) {
            // Request an OpenGL ES 2.0 compatible context.
            mGLSurfaceView.setEGLContextClientVersion(2);

            // Set the renderer to out demo renderer, define below
//            mGLSurfaceView.setRenderer(new LessonTwoRenderer());
            mGLSurfaceView.setRenderer(new NativeTwoRenderer());
        } else {
            // This is where you could create an OpenGL ES 1.x compatible
            // renderer if you wanted to support both ES 1 and ES 2
            return;
        }
        setContentView(mGLSurfaceView);
    }
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:26,代码来源:LessonTwoActivity.java

示例5: onCreate

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mGLSurfaceView = new GLSurfaceView(this);

        // Check if the system support OpenGL ES 2.0
        final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
        final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

        if (supportsEs2) {
            // Request an OpenGL ES 2.0 compatible context.
            mGLSurfaceView.setEGLContextClientVersion(2);

            // Set the renderer to out demo renderer, define below
//             mGLSurfaceView.setRenderer(new LessonOneRenderer());
            // or set a native implementation
            mGLSurfaceView.setRenderer(new NativeOneRenderer());
        } else {
            // This is where you could create an OpenGL ES 1.x compatible
            // renderer if you wanted to support both ES 1 and ES 2
            return;
        }
        setContentView(mGLSurfaceView);
    }
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:27,代码来源:LessonOneActivity.java

示例6: onCreate

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_opengl);
        Log.d(TAG,"1->" + System.currentTimeMillis());
        mGlSurfaceView = (GLSurfaceView) findViewById(R.id.surfaceView);
        mGlSurfaceView.setEGLContextClientVersion(EGL_VERSION);
        Log.d(TAG,"2->" + System.currentTimeMillis());
//        mGlSurfaceView.setEGLContextClientVersion(2);
//        mGlSurfaceView.setRenderer(new MyRender(new Square()));
//        mGlSurfaceView.setRenderer(new MyRender(new Cube(1.0f,1.0f,1.0f)));
//        mGlSurfaceView.setRenderer(new MyRender(new Texture(this)));
        mGlSurfaceView.setRenderer(new Example6_3Renderer(this));



        GLSurfaceView glSurfaceView = (GLSurfaceView) findViewById(R.id.surfaceView2);
        glSurfaceView.setEGLContextClientVersion(EGL_VERSION);
        glSurfaceView.setRenderer(new Example6_3Renderer(this));
        Log.d(TAG,"6->" + System.currentTimeMillis());
    }
 
开发者ID:zhuangzaiku,项目名称:AndroidCollection,代码行数:22,代码来源:OpenGLActivity.java

示例7: onResume

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
        Intent intent = new Intent(this, RequestPermissionsActivity.class);
        intent.putExtra(EXTRA_MESSAGE, "Request");
        startActivity(intent);
        // Should we show an explanation?
        /*if (ActivityCompat.shouldShowRequestPermissionRationale( this, Manifest.permission.CAMERA)) {
            // Show an explanation to the user *asynchronously* -- don't block this thread waiting for the user's response! After the user sees the explanation, try again to request the permission.
        }else{
            // No explanation needed, we can request the permission.
            ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, MY_PERMISSIONS_REQUEST_CAMERA);
        }*/
    }
    glView = new GLSurfaceView( this );// Now let's create an OpenGL surface.
    glView.setEGLConfigChooser( 8, 8, 8, 8, 16, 0 );
    glView.getHolder().setFormat( PixelFormat.TRANSLUCENT );// To see the camera preview, the OpenGL surface has to be created translucently.
    glView.setRenderer( new GLClearRenderer() );// The renderer will be implemented in a separate class, GLView, which I'll show next.
    setContentView( glView );// Now set this as the main view.
    if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
        cameraView = new CameraView(this);// Now also create a view which contains the camera preview...
        addContentView(cameraView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));// ...and add it, wrapping the full screen size.
    }


}
 
开发者ID:GregoireSailland,项目名称:AR,代码行数:28,代码来源:Launcher.java

示例8: onCreate

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_camera_capture);

    File outputFile = new File(getFilesDir(), "camera-test.mp4");
    TextView fileText = (TextView) findViewById(R.id.cameraOutputFile_text);
    fileText.setText(outputFile.toString());

    Spinner spinner = (Spinner) findViewById(R.id.cameraFilter_spinner);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
            R.array.cameraFilterNames, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner.
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(this);

    // Define a handler that receives camera-control messages from other threads.  All calls
    // to Camera must be made on the same thread.  Note we create this before the renderer
    // thread, so we know the fully-constructed object will be visible.
    mCameraHandler = new CameraHandler(this);

    mRecordingEnabled = sVideoEncoder.isRecording();

    // Configure the GLSurfaceView.  This will start the Renderer thread, with an
    // appropriate EGL context.
    mGLView = (GLSurfaceView) findViewById(R.id.cameraPreview_surfaceView);
    mGLView.setEGLContextClientVersion(2);     // select GLES 2.0
    mRenderer = new CameraSurfaceRenderer(mCameraHandler, sVideoEncoder, outputFile);
    mGLView.setRenderer(mRenderer);
    mGLView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);

    Log.d(TAG, "onCreate complete: " + this);
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:35,代码来源:CameraCaptureActivity.java

示例9: TiledImageView

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
public TiledImageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mRenderer = new ImageRendererWrapper();
    mRenderer.image = new TiledImageRenderer(this);
    mGLSurfaceView = new GLSurfaceView(context);
    mGLSurfaceView.setEGLContextClientVersion(2);
    mGLSurfaceView.setRenderer(new TileRenderer());
    mGLSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
    addView(mGLSurfaceView, new LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:12,代码来源:TiledImageView.java

示例10: onCreate

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);   
    requestWindowFeature(Window.FEATURE_NO_TITLE);
   
    mView = new GLSurfaceView(this);
    mView.setEGLContextClientVersion(2);
    mView.setRenderer(new GLLayer(this));
    
    setContentView(mView);
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:13,代码来源:MainActivity.java

示例11: onCreate

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mGLView = new GLSurfaceView(this);
    GLRenderer renderer = new GLRenderer();
    mGLView.setEGLContextClientVersion(2);
    mGLView.setRenderer(renderer);
    mGLView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
    setContentView(mGLView);
}
 
开发者ID:beetsolutions,项目名称:opengl_circle,代码行数:11,代码来源:MainActivity.java

示例12: onCreate

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    /**
     * Initialize the renderer and tell it to only render when
     * explicity requested with the RENDERMODE_WHEN_DIRTY option
     */
    mEffectView = (GLSurfaceView) findViewById(R.id.effectsview);
    mEffectView.setEGLContextClientVersion(2);
    mEffectView.setRenderer(this);
    mEffectView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
    mCurrentEffect = R.id.none;
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:15,代码来源:HelloEffects.java

示例13: onCreate

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        Log.d(TAG, "SAMPLE PAth: " + SAMPLE);
        setContentView(R.layout.activity_main);
        niceSpinner = (NiceSpinner)findViewById(R.id.cameraFilter_spinner);
        List<String> dataset = new LinkedList<>(Arrays.asList("正常 ","黑白 ", "模糊 ", "锐化 ", "边缘 ", "浮雕 "));
        niceSpinner.attachDataSource(dataset);
        listenControl = (LinearLayout)findViewById(R.id.listen_control);
        selectFileBtn = (Button)findViewById(R.id.open_file);
        control = (LinearLayout)findViewById(R.id.control);
        glSurfaceView = (GLSurfaceView) findViewById(R.id.glSurfaceView);
        SeekBar seekBar = (SeekBar) findViewById(R.id.seekbar);

        videoRenderer = new VideoRenderer(MainActivity.this, glSurfaceView, seekBar, videoPath);
        glSurfaceView.setEGLContextClientVersion(2);
        glSurfaceView.setRenderer(videoRenderer);
        glSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
//        Log.d(TAG, SAMPLE);

        niceSpinner.setOnTouchListener(this);
        niceSpinner.setOnItemSelectedListener(this);
        niceSpinner.dismissDropDown();
        pause = (Button) findViewById(R.id.pause);
        // avoid clicking without video

        pause.setEnabled(false);

        pause.setOnClickListener(this);
        selectFileBtn.setOnClickListener(this);
        glSurfaceView.setOnClickListener(this);


    }
 
开发者ID:TobiasLee,项目名称:FilterPlayer,代码行数:35,代码来源:MainActivity.java

示例14: onCreate

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    boolean supportES2 = configurationInfo.reqGlEsVersion >= 0x2000;
    if (supportES2) {
        mGlSurfaceView = new GLSurfaceView(this);
        mGlSurfaceView.setEGLContextClientVersion(2);
        mGlSurfaceView.setRenderer(new RendererWrapper());
        rendererSet = true;
        setContentView(mGlSurfaceView);
    }
}
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:16,代码来源:NativeLesson1Activity.java

示例15: onCreate

import android.opengl.GLSurfaceView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) 
{
	super.onCreate(savedInstanceState);
	
	mGLSurfaceView = new GLSurfaceView(this);

	// Check if the system supports OpenGL ES 2.0.
	final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
	final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
	final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

	if (supportsEs2) 
	{
		// Request an OpenGL ES 2.0 compatible context.
		mGLSurfaceView.setEGLContextClientVersion(2);

		// Set the renderer to our demo renderer, defined below.
		mGLSurfaceView.setRenderer(new LessonThreeRenderer());
	} 
	else 
	{
		// This is where you could create an OpenGL ES 1.x compatible
		// renderer if you wanted to support both ES 1 and ES 2.
		return;
	}

	setContentView(mGLSurfaceView);
}
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:30,代码来源:LessonThreeActivity.java


注:本文中的android.opengl.GLSurfaceView.setRenderer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。