glsurfaceview

OpenGl基础使用

风流意气都作罢 提交于 2019-12-02 09:05:24
OpenGL:对比canvas绘制,直接使用GPU绘制,是最高效的方法。GPU来分担CPU的工作,从而提高效率。 先添加权限 1,要使用opengl要先初始化他的载体,GLsurfaceview,可以配置内容渲染是在surfaceview的特定区域完成。实质上是会自己创建一个window,没有动画或者变形效果 1)onCreate{ gl = new GLSurfaceView(); setContentView(gl); } 2)“configurationInfo.reqGlEsVersion >= 0x20000” // 检测opengl是否支持2.0 3)通过setGLContextClientVersion()配置surfaceview的视图; 4)通过setRenderer()来传入一个自定义的Renderer类,当surfaceview创建或者发生改变以及绘制新一帧的时候,渲染器都会被GLSurfaceView调用 5)处理Activity的生命周期事件,GLSurfaceView要协同好Activity生命周期,防止内存泄漏 6)创建Renderer类 GLSurfaceView会新开启一个线程去绘制,最后会在ui线程调用,通过queneEvent()传递Runnable对象给子线程,再通过runonuiThread()切换到主线程调用

GLSurfaceView not appearing over MapView

别说谁变了你拦得住时间么 提交于 2019-12-02 04:22:24
My goal is to use OpenGL ES 2.0 with Google Maps. I would like to create an app that follows the user as they are traveling from point A to point B. I realize that this can be done using Google Maps addPolyline to draw a line, but I want to use OpenGL instead in order to show overlap of paths. I'm currently receiving an error which is due to incorrectly setting up the GLSurfaceView. My code in the GoogleMapsTracker class is as follows: private MapView mapView; private GoogleMap map; private GLSurfaceView mGLSurfaceView; /** * Use this factory method to create a new instance of * this fragment

Playing video in a GLSurfaceView instead of SurfaceView

只愿长相守 提交于 2019-12-01 21:06:18
问题 I've been struggling with this for 2 days now... Following this answer: https://stackoverflow.com/a/2006454/444324 - it is mentioned that it's possible to play a video in a GLSurfaceView by altering the MediaPlayerDemo_Video example in API Demos: All you have to do there is to replace the SurfaceView with a GLSurfaceView in both the MediaPlayerDemo_Video.java file as well as in the corresponding layout file (mediaplayer_2.xml). Also you need to create a custom Renderer class (one that

Sharing the GLES20 context and textures between different GLSurfaceViews?

不想你离开。 提交于 2019-12-01 05:32:39
问题 Is it possible to share the GLES20 context between different GLSurfaceViews (within one Activity)? Alternatively, how would one share a set of texture between different GLSurfaceViews? On iOS, if you want to conserve memory and reuse (large) textures in different CAEAGLLayer-backed UIViews, you can pass around a EAGLContext object between them or use different EAGLContexts which share a common EAGLSharegroup object. I wonder how to accomplish this on Android. Is there any equivalent technique

Android glSurfaceView with overlay using XML/Java

白昼怎懂夜的黑 提交于 2019-12-01 04:57:49
I started an Android OpenGL application and I have the following classes: class A extends Activity class B extends GlSurfaceView implements Renderer When class A's onCreate is called, it creates an object of type class B and calls: setContentView(Bobject) So far it works and I spent a few days on it. Now I wanted to add buttons to my application and found the SurfaceViewOverlay example. That uses some XML to create a view hierarchy. I wanted to create something very similar to I simply cut and paste the XML code: <android.opengl.GLSurfaceView android:id="@+id/glsurfaceview" android:layout

Android glSurfaceView with overlay using XML/Java

痴心易碎 提交于 2019-12-01 02:34:53
问题 I started an Android OpenGL application and I have the following classes: class A extends Activity class B extends GlSurfaceView implements Renderer When class A's onCreate is called, it creates an object of type class B and calls: setContentView(Bobject) So far it works and I spent a few days on it. Now I wanted to add buttons to my application and found the SurfaceViewOverlay example. That uses some XML to create a view hierarchy. I wanted to create something very similar to I simply cut

how to build a GUI/HUD over top a glSurfaceView in android

好久不见. 提交于 2019-12-01 01:24:37
I have an glSurfaceView that looks like this: public class GLLayer extends GLSurfaceView implements SurfaceHolder.Callback, Camera.PreviewCallback, Renderer { private Context context; private Circle cRing; private CompassNeedle cNeedle; private MarkerNorth mNorth; private MarkerEast mEast; private MarkerSouth mSouth; private MarkerWest mWest; private MarkerSouthWest mSWest; private MarkerSouthEast mSEast; private MarkerNorthWest mNWest; private MarkerNorthEast mNEast; private MarkerWest mGod; private MarkerCustom userTag; ArrayList <MarkerCustom> locationTags; private PhoneOrientation phoneOri

FrameBuffers with GLSurfaceView pattern in OpenGLES 1.1 on android ndk

我是研究僧i 提交于 2019-11-30 23:43:01
in Android NDK, is it possible to make OpenGL ES 1.1 work with the typical java-side GLSurfaceView pattern (overriding methods from GLSurfaceView.Renderer onDrawFrame, onSurfaceCreated, etc.) while using in the C++ side the frame, color and depth buffers, and VBO? I am trying to create them using this: void ES1Renderer::on_surface_created() { // Create default framebuffer object. The backing will be allocated for the current layer in -resizeFromLayer glGenFramebuffersOES(1, &defaultFramebuffer); glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer); // Create color renderbuffer object.

FrameBuffers with GLSurfaceView pattern in OpenGLES 1.1 on android ndk

Deadly 提交于 2019-11-30 17:26:09
问题 in Android NDK, is it possible to make OpenGL ES 1.1 work with the typical java-side GLSurfaceView pattern (overriding methods from GLSurfaceView.Renderer onDrawFrame, onSurfaceCreated, etc.) while using in the C++ side the frame, color and depth buffers, and VBO? I am trying to create them using this: void ES1Renderer::on_surface_created() { // Create default framebuffer object. The backing will be allocated for the current layer in -resizeFromLayer glGenFramebuffersOES(1,

GL Surface and Visibility: Gone

走远了吗. 提交于 2019-11-30 14:06:18
So I have a GLSurfaceView in my app being rendered by a GLSurfaceView.Renderer and using JPCt as library. The surface is in an invisible RelativeLayout (visibility: gone). When I change the visibility to "visible" then back to "gone", the layout shows and hides as expected, but the GLSurfaceView don't, it just shows and won't hide, even though I can click on items that are now "behind" it. It seems like some graphical buffer issue, but I didn't find a way to get this to work... any ideas? Thanks! rkapl SurfaceView (and GLSurfaceView by extension) are interesting beasts in Android. Citation