-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from ashqal/textureview
#75 GLTextureView worked, but not support setPreserveEGLContextOnPause
- Loading branch information
Showing
8 changed files
with
1,916 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
app/src/main/res/layout/activity_md_using_texture_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".MD360PlayerActivity"> | ||
|
||
<FrameLayout | ||
android:orientation="horizontal" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
<com.google.android.apps.muzei.render.GLTextureView | ||
android:id="@+id/gl_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
</FrameLayout> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="horizontal"> | ||
<android.support.v7.widget.AppCompatSpinner | ||
android:layout_marginLeft="0dp" | ||
android:paddingLeft="0dp" | ||
android:paddingRight="0dp" | ||
android:id="@+id/spinner_interactive" | ||
android:layout_width="100dp" | ||
android:minWidth="100dp" | ||
android:layout_height="wrap_content"/> | ||
|
||
<android.support.v7.widget.AppCompatSpinner | ||
android:layout_marginLeft="8dp" | ||
android:paddingLeft="0dp" | ||
android:paddingRight="0dp" | ||
android:id="@+id/spinner_display" | ||
android:layout_width="100dp" | ||
android:minWidth="100dp" | ||
android:layout_height="wrap_content"/> | ||
|
||
<android.support.v7.widget.AppCompatSpinner | ||
android:layout_marginLeft="8dp" | ||
android:paddingLeft="0dp" | ||
android:paddingRight="0dp" | ||
android:id="@+id/spinner_projection" | ||
android:layout_width="100dp" | ||
android:minWidth="100dp" | ||
android:layout_height="wrap_content"/> | ||
</LinearLayout> | ||
|
||
<ProgressBar | ||
android:layout_centerInParent="true" | ||
android:id="@+id/progress" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" /> | ||
|
||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package com.asha.vrlib; | ||
|
||
import android.content.Context; | ||
import android.opengl.GLSurfaceView; | ||
import android.view.View; | ||
|
||
import com.google.android.apps.muzei.render.GLTextureView; | ||
|
||
/** | ||
* Created by hzqiujiadi on 16/7/11. | ||
* hzqiujiadi [email protected] | ||
*/ | ||
public abstract class MDGLScreenWrapper { | ||
abstract public View getView(); | ||
abstract public void setRenderer(GLSurfaceView.Renderer renderer); | ||
abstract public void init(Context context); | ||
abstract public void onResume(); | ||
abstract public void onPause(); | ||
|
||
public static MDGLScreenWrapper wrap(GLSurfaceView glSurfaceView){ | ||
return new MDGLSurfaceViewImpl(glSurfaceView); | ||
} | ||
|
||
public static MDGLScreenWrapper wrap(GLTextureView glTextureView){ | ||
return new MDGLTextureViewImpl(glTextureView); | ||
} | ||
|
||
private static class MDGLTextureViewImpl extends MDGLScreenWrapper { | ||
|
||
GLTextureView glTextureView; | ||
|
||
public MDGLTextureViewImpl(GLTextureView glTextureView) { | ||
this.glTextureView = glTextureView; | ||
} | ||
|
||
@Override | ||
public View getView() { | ||
return glTextureView; | ||
} | ||
|
||
@Override | ||
public void setRenderer(GLSurfaceView.Renderer renderer) { | ||
glTextureView.setRenderer(renderer); | ||
} | ||
|
||
@Override | ||
public void init(Context context) { | ||
glTextureView.setEGLContextClientVersion(2); | ||
// not supported | ||
// glTextureView.setPreserveEGLContextOnPause(true); | ||
} | ||
|
||
@Override | ||
public void onResume() { | ||
glTextureView.onResume(); | ||
} | ||
|
||
@Override | ||
public void onPause() { | ||
glTextureView.onPause(); | ||
} | ||
} | ||
|
||
private static class MDGLSurfaceViewImpl extends MDGLScreenWrapper { | ||
|
||
GLSurfaceView glSurfaceView; | ||
|
||
private MDGLSurfaceViewImpl(GLSurfaceView glSurfaceView) { | ||
this.glSurfaceView = glSurfaceView; | ||
} | ||
|
||
@Override | ||
public View getView() { | ||
return glSurfaceView; | ||
} | ||
|
||
@Override | ||
public void setRenderer(GLSurfaceView.Renderer renderer) { | ||
glSurfaceView.setRenderer(renderer); | ||
} | ||
|
||
@Override | ||
public void init(Context context) { | ||
glSurfaceView.setEGLContextClientVersion(2); | ||
glSurfaceView.setPreserveEGLContextOnPause(true); | ||
} | ||
|
||
@Override | ||
public void onResume() { | ||
glSurfaceView.onResume(); | ||
} | ||
|
||
@Override | ||
public void onPause() { | ||
glSurfaceView.onPause(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.