Questions tagged [glsurfaceview]

GLSurfaceView is a subclass of SurfaceView for Android. It provides a dedicated surface for displaying OpenGL ES rendering.

GLSurfaceView extends SurfaceView, providing:

  • EGL context creation and management.
  • Renderer thread management.

The class is just a wrapper around SurfaceView. It's not necessary to use GLSurfaceView to render with OpenGL ES; a plain SurfaceView or TextureView will work. If you want more control over the EGL context lifetime, or better control over when rendering occurs, use one of the other classes.

For a simple example of a game written with GLSurfaceView, see Android Breakout.

Additional details about GLSurfaceView can be found in the graphics architecture document. The appendix on game loops may also be relevant, as games are one of the more common uses for GLSurfaceView. Examples of using GLES with SurfaceView and TextureView can be found in Grafika.

539 questions
11
votes
4 answers

Android draw on camera preview

I'm making a virtual reality application where the camera should detect faces, locate them and show their location on the camera preview. I know of 3 ways to do it, I'd like to use GLSurfaceView to be as fast as possible (according to this post),…
Solenoid
  • 2,351
  • 5
  • 29
  • 48
10
votes
2 answers

Android: apply OpenGL effects to camera

Is there any way in Android to use a GLSurfaceView to display the camera preview, while using OpenGL effects on that surface? Specifically additive blending effects. I know OpenGL can use the effects, and I know the camera can be placed on a…
Patrick D
  • 6,659
  • 3
  • 43
  • 55
10
votes
1 answer

Why is there no onSurfaceDestroyed method in GLSurfaceView.Renderer?

I am working on an Android app that performs OpenCL/OpenGL interops on the camera perview. I am using GLSurfaceView.Renderer. Naturally the code to create and initialize the OpenCL running environment (from OpenGL) is called from onSurfaceCreated,…
hubeir
  • 1,279
  • 2
  • 13
  • 24
9
votes
0 answers

Problem when resizing and resuming/pausing GLSurfaceView

I use GLSurfaceView in my app and recently discovered a strange behavior when resizing it. Finally, I figured out what causes the problem in my app and created a simple example to reproduce it. Let say we have a FrameLayout containing simple…
frumle
  • 593
  • 5
  • 15
9
votes
0 answers

How to properly rotate Android device with GLSurfaceView while containing OpenGL context and GL thread?

I have a simple Android application that renders data with our OpenGL rendering SDK to an Android GLSurfaceView. Since we provide and SDK for others to use we need to support all use cases for the GLSurfaceViews. Currently we need to be able to…
Krøllebølle
  • 2,878
  • 6
  • 54
  • 79
9
votes
1 answer

GLSurfaceView continuously renders despite changing render mode

I'm trying to create a GLSurfaceView that displays a map of a game area. When the player moves, the game activity calls highlightSpot, which in turn should trigger a render request. The only time I want to re-draw the view is when the player…
Jason Plank
  • 2,336
  • 5
  • 31
  • 40
9
votes
2 answers

How can I put a view on top of a glSurfaceView with a transparent background?

My app is composed (from back to front) of an image background, then a glSurfaceView containing a 3D object and on the top 2 buttons. I want the background of the GLSurfaceView to be transparent and see the image behind. I've tried two solutions,…
PopGorn
  • 131
  • 1
  • 5
9
votes
1 answer

Why is glClear blocking in OpenGLES?

I'm trying to profile my renderer, and I'm seeing some weird profiling behavior that I can't explain. I'm using a glSurfaceView, which I have set to render continuously. This is how my onDrawFrame() is structured public void onDrawFrame(GL10 unused)…
Tim
  • 35,413
  • 11
  • 95
  • 121
8
votes
2 answers

Having a EditText over a soft keyboard with a GL View in the background programmatically

I am working on a game and I want an EditText position above the soft keyboard when it pops up. Here is what my code looks like when I build the View Hierarchy in my Main…
8
votes
2 answers

Drawing Android UI on top of GLSurfaceView

For my game, I am thinking of drawing UI elements (TextView for displaying time elapsed, Buttons for pausing/restarting game) on top of my GLSurfaceView using RelativeLayout... Till now, I was drawing all the UI elements myself directly to…
BLOB
  • 364
  • 2
  • 7
  • 21
8
votes
1 answer

GL Surface and Visibility: Gone

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…
arvere
  • 727
  • 1
  • 7
  • 21
8
votes
2 answers

Android - show grid lines on camera

I am newbie in android application development. I want to create an application that get stream from camera and show on SurfaceView or on FrameLayout. I need an option shows above on streaming "Show Grid Lines", when user click on it grid lines…
mohsin.mr
  • 498
  • 1
  • 6
  • 21
7
votes
1 answer

Android GLSurfaceView causes leak?

I am trying to use GLSurfaceView on Android and experiencing problems. I am using the code from this OpenGL article. It works well but when I rotate the device, I notice that the allocated memory is growing. So I use MAT to check if I have a memory…
7
votes
2 answers

Android CameraX GLSurfaceView

Please, can someone provide good example of using CameraX library with GLSurfaceView, can't find any information.
Nikita Unkovsky
  • 631
  • 1
  • 7
  • 13
7
votes
1 answer

Android Camera Live Filter

What is the best way for Camera Live filters. I am recently using GPUImage Library from Link: https://github.com/CyberAgent/android-gpuimagelibrary. Than I have found SurfaceView and GLSurfaceView. Problem is: How to apply live filter to camera…
1
2
3
35 36