public class TrimbleMapsGLSurface
extends java.lang.Object
GLSurfaceView
extension that notifies a listener when the view is detached from window,
which is the point of destruction of the GL thread.Modifier and Type | Class | Description |
---|---|---|
static interface |
TrimbleMapsGLSurface.OnGLSurfaceViewDetachedListener |
Listener interface that notifies when a
TrimbleMapsGLSurfaceView is detached from window. |
Modifier and Type | Field | Description |
---|---|---|
com.trimblemaps.mapsdk.maps.renderer.glsurfaceview.TrimbleMapsGLSurface.GLThread |
glThread |
|
static android.view.Surface |
mSurface |
Constructor | Description |
---|---|
TrimbleMapsGLSurface(android.content.Context context) |
Standard View constructor.
|
TrimbleMapsGLSurface(android.content.Context context,
android.util.AttributeSet attrs) |
Standard View constructor.
|
TrimbleMapsGLSurface(android.content.Context context,
android.view.Surface surface) |
Modifier and Type | Method | Description |
---|---|---|
protected void |
finalize() |
|
boolean |
getPreserveEGLContextOnPause() |
|
int |
getRenderMode() |
Get the current rendering mode.
|
void |
onPause() |
Pause the rendering thread, optionally tearing down the EGL context
depending upon the value of
setPreserveEGLContextOnPause(boolean) . |
void |
onResume() |
Resumes the rendering thread, re-creating the OpenGL context if necessary.
|
void |
queueEvent(java.lang.Runnable r) |
Queue a runnable to be run on the GL rendering thread.
|
void |
requestRender() |
Request that the renderer render a frame.
|
void |
setDetachedListener(TrimbleMapsGLSurface.OnGLSurfaceViewDetachedListener detachedListener) |
Set a listener that gets notified when the view is detached from window.
|
void |
setEGLConfigChooser(android.opengl.GLSurfaceView.EGLConfigChooser configChooser) |
Install a custom EGLConfigChooser.
|
void |
setEGLContextFactory(android.opengl.GLSurfaceView.EGLContextFactory factory) |
Install a custom EGLContextFactory.
|
void |
setEGLWindowSurfaceFactory(android.opengl.GLSurfaceView.EGLWindowSurfaceFactory factory) |
Install a custom EGLWindowSurfaceFactory.
|
void |
setPreserveEGLContextOnPause(boolean preserveOnPause) |
Control whether the EGL context is preserved when the GLSurfaceView is paused and
resumed.
|
void |
setRenderer(android.opengl.GLSurfaceView.Renderer renderer) |
Set the renderer associated with this view.
|
void |
setRenderMode(int renderMode) |
Set the rendering mode.
|
void |
surfaceChanged(int w,
int h) |
|
void |
surfaceChanged(android.view.SurfaceHolder holder,
int format,
int w,
int h) |
This method is part of the SurfaceHolder.Callback interface, and is
not normally called or subclassed by clients of GLSurfaceView.
|
void |
surfaceCreated() |
|
void |
surfaceCreated(android.view.SurfaceHolder holder) |
This method is part of the SurfaceHolder.Callback interface, and is
not normally called or subclassed by clients of GLSurfaceView.
|
void |
surfaceDestroyed(android.view.SurfaceHolder holder) |
This method is part of the SurfaceHolder.Callback interface, and is
not normally called or subclassed by clients of GLSurfaceView.
|
void |
surfaceRedrawNeededAsync(android.view.SurfaceHolder holder,
java.lang.Runnable finishDrawing) |
public com.trimblemaps.mapsdk.maps.renderer.glsurfaceview.TrimbleMapsGLSurface.GLThread glThread
public static android.view.Surface mSurface
public TrimbleMapsGLSurface(android.content.Context context)
setRenderer(android.opengl.GLSurfaceView.Renderer)
to register a renderer.public TrimbleMapsGLSurface(android.content.Context context, android.view.Surface surface)
public TrimbleMapsGLSurface(android.content.Context context, android.util.AttributeSet attrs)
setRenderer(android.opengl.GLSurfaceView.Renderer)
to register a renderer.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void setDetachedListener(@NonNull TrimbleMapsGLSurface.OnGLSurfaceViewDetachedListener detachedListener)
detachedListener
- listenerpublic void setPreserveEGLContextOnPause(boolean preserveOnPause)
If set to true, then the EGL context may be preserved when the GLSurfaceView is paused.
Prior to API level 11, whether the EGL context is actually preserved or not depends upon whether the Android device can support an arbitrary number of EGL contexts or not. Devices that can only support a limited number of EGL contexts must release the EGL context in order to allow multiple applications to share the GPU.
If set to false, the EGL context will be released when the GLSurfaceView is paused, and recreated when the GLSurfaceView is resumed.
The default is false.
preserveOnPause
- preserve the EGL context when pausedpublic boolean getPreserveEGLContextOnPause()
public void setRenderer(android.opengl.GLSurfaceView.Renderer renderer)
This method should be called once and only once in the life-cycle of a GLSurfaceView.
The following GLSurfaceView methods can only be called before setRenderer is called:
The following GLSurfaceView methods can only be called after setRenderer is called:
renderer
- the renderer to use to perform OpenGL drawing.public void setEGLContextFactory(android.opengl.GLSurfaceView.EGLContextFactory factory)
If this method is
called, it must be called before setRenderer(GLSurfaceView.Renderer)
is called.
public void setEGLWindowSurfaceFactory(android.opengl.GLSurfaceView.EGLWindowSurfaceFactory factory)
If this method is
called, it must be called before setRenderer(GLSurfaceView.Renderer)
is called.
public void setEGLConfigChooser(android.opengl.GLSurfaceView.EGLConfigChooser configChooser)
If this method is
called, it must be called before setRenderer(GLSurfaceView.Renderer)
is called.
public void setRenderMode(int renderMode)
requestRender()
is called. Defaults to RENDERMODE_CONTINUOUSLY.
Using RENDERMODE_WHEN_DIRTY can improve battery life and overall system performance by allowing the GPU and CPU to idle when the view does not need to be updated.
This method can only be called after setRenderer(GLSurfaceView.Renderer)
renderMode
- one of the RENDERMODE_X constantspublic int getRenderMode()
public void requestRender()
public void surfaceCreated(android.view.SurfaceHolder holder)
public void surfaceCreated()
public void surfaceDestroyed(android.view.SurfaceHolder holder)
public void surfaceChanged(android.view.SurfaceHolder holder, int format, int w, int h)
public void surfaceChanged(int w, int h)
public void surfaceRedrawNeededAsync(android.view.SurfaceHolder holder, java.lang.Runnable finishDrawing)
public void onPause()
setPreserveEGLContextOnPause(boolean)
.
Must not be called before a renderer has been set.
public void onResume()
onPause()
.
Must not be called before a renderer has been set.
public void queueEvent(java.lang.Runnable r)
r
- the runnable to be run on the GL rendering thread.