Java Code Examples for android.opengl.GLSurfaceView#setZOrderOnTop()
The following examples show how to use
android.opengl.GLSurfaceView#setZOrderOnTop() .
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: FlipViewController.java From UltimateAndroid with Apache License 2.0 | 5 votes |
private void setupSurfaceView(Context context) { surfaceView = new GLSurfaceView(getContext()); cards = new FlipCards(this, flipOrientation == VERTICAL); renderer = new FlipRenderer(this, cards); surfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0); surfaceView.setZOrderOnTop(true); surfaceView.setRenderer(renderer); surfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT); surfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); addViewInLayout(surfaceView, -1, new AbsListView.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT), false); }
Example 2
Source File: FlipViewController.java From UltimateAndroid with Apache License 2.0 | 5 votes |
private void setupSurfaceView(Context context) { surfaceView = new GLSurfaceView(getContext()); cards = new FlipCards(this, flipOrientation == VERTICAL); renderer = new FlipRenderer(this, cards); surfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0); surfaceView.setZOrderOnTop(true); surfaceView.setRenderer(renderer); surfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT); surfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); addViewInLayout(surfaceView, -1, new AbsListView.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT), false); }
Example 3
Source File: OGLESContext.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * <code>createView</code> creates the GLSurfaceView that the renderer will * draw to. <p> The result GLSurfaceView will receive input events and * forward them to the Application. Any rendering will be done into the * GLSurfaceView. Only one GLSurfaceView can be created at this time. The * given configType specifies how to determine the display configuration. * * @return GLSurfaceView The newly created view */ public GLSurfaceView createView(Context context) { ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ConfigurationInfo info = am.getDeviceConfigurationInfo(); // NOTE: We assume all ICS devices have OpenGL ES 2.0. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // below 4.0, check OpenGL ES 2.0 support. if (info.reqGlEsVersion < 0x20000) { throw new UnsupportedOperationException("OpenGL ES 2.0 or better is not supported on this device"); } } else if (Build.VERSION.SDK_INT < 9){ throw new UnsupportedOperationException("jME3 requires Android 2.3 or later"); } // Start to set up the view GLSurfaceView view = new GLSurfaceView(context); logger.log(Level.INFO, "Android Build Version: {0}", Build.VERSION.SDK_INT); if (androidInput == null) { if (Build.VERSION.SDK_INT >= 14) { androidInput = new AndroidInputHandler14(); } else if (Build.VERSION.SDK_INT >= 9){ androidInput = new AndroidInputHandler(); } } androidInput.setView(view); androidInput.loadSettings(settings); // setEGLContextClientVersion must be set before calling setRenderer // this means it cannot be set in AndroidConfigChooser (too late) // use proper openGL ES version view.setEGLContextClientVersion(info.reqGlEsVersion>>16); view.setFocusableInTouchMode(true); view.setFocusable(true); // setFormat must be set before AndroidConfigChooser is called by the surfaceview. // if setFormat is called after ConfigChooser is called, then execution // stops at the setFormat call without a crash. // We look at the user setting for alpha bits and set the surfaceview // PixelFormat to either Opaque, Transparent, or Translucent. // ConfigChooser will do its best to honor the alpha requested by the user // For best rendering performance, use Opaque (alpha bits = 0). int curAlphaBits = settings.getAlphaBits(); logger.log(Level.FINE, "curAlphaBits: {0}", curAlphaBits); if (curAlphaBits >= 8) { logger.log(Level.FINE, "Pixel Format: TRANSLUCENT"); view.getHolder().setFormat(PixelFormat.TRANSLUCENT); view.setZOrderOnTop(true); } else if (curAlphaBits >= 1) { logger.log(Level.FINE, "Pixel Format: TRANSPARENT"); view.getHolder().setFormat(PixelFormat.TRANSPARENT); } else { logger.log(Level.FINE, "Pixel Format: OPAQUE"); view.getHolder().setFormat(PixelFormat.OPAQUE); } AndroidConfigChooser configChooser = new AndroidConfigChooser(settings); view.setEGLConfigChooser(configChooser); view.setRenderer(this); // Attempt to preserve the EGL Context on app pause/resume. // Not destroying and recreating the EGL context // will help with resume time by reusing the existing context to avoid // reloading all the OpenGL objects. if (Build.VERSION.SDK_INT >= 11) { view.setPreserveEGLContextOnPause(true); } return view; }