當前位置: 首頁>>代碼示例>>Java>>正文


Java GLSurfaceView.setEGLContextClientVersion方法代碼示例

本文整理匯總了Java中android.opengl.GLSurfaceView.setEGLContextClientVersion方法的典型用法代碼示例。如果您正苦於以下問題:Java GLSurfaceView.setEGLContextClientVersion方法的具體用法?Java GLSurfaceView.setEGLContextClientVersion怎麽用?Java GLSurfaceView.setEGLContextClientVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.opengl.GLSurfaceView的用法示例。


在下文中一共展示了GLSurfaceView.setEGLContextClientVersion方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.opengl.GLSurfaceView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (!Utils.supportGlEs20(this)) {
        Toast.makeText(this, "GLES 2.0 not supported!", Toast.LENGTH_LONG).show();
        finish();
        return;
    }

    mGLSurfaceView = (GLSurfaceView) findViewById(R.id.surface);

    mGLSurfaceView.setEGLContextClientVersion(2);
    mRenderer = new DemoRenderer(this);
    mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
    mGLSurfaceView.setRenderer(mRenderer);
    mGLSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
}
 
開發者ID:Piasy,項目名稱:OpenGLESTutorial-Android,代碼行數:20,代碼來源:MainActivity.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 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

示例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 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

示例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 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

示例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 LessonFourRenderer(this));
            mGLSurfaceView.setRenderer(new NativeFourRenderer(this));
        } 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,代碼來源:LessonFourActivity.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: 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

示例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: 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

示例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: 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

示例12: 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

示例13: 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

示例14: 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

示例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 LessonTwoRenderer());
	} 
	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,代碼來源:LessonTwoActivity.java


注:本文中的android.opengl.GLSurfaceView.setEGLContextClientVersion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。