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
61
votes
5 answers

GLSurfaceView inside fragment not rendering when restarted

I have a GLSurfaceView set up and rendering as expected using a GLSurfaceView.Renderer. My App uses fragments from the android support package. When I navigate to a new fragment surfaceDestroyed is called but when I come back to the fragment via the…
Ian Ellis
  • 650
  • 5
  • 10
38
votes
4 answers

Capture screen of GLSurfaceView to bitmap

I need to be able to capture an image of a GLSurfaceView at certain moment in time. I have the following code: relative.setDrawingCacheEnabled(true); screenshot =…
SamRowley
  • 3,435
  • 7
  • 48
  • 77
28
votes
2 answers

TextureView vs. GLSurfaceView or How to use GLSurfaceView with EGL14

I am getting confused with EGL. My GLSurfaceView creates an EGLContext. Now I create a shared context. Now I need to use a EGLExtension. The Method I have to use is called (>=API18): EGLExt.eglPresentationTimeANDROID(android.opengl.EGLDisplay…
andre
  • 1,618
  • 2
  • 19
  • 38
25
votes
1 answer

Applying Effects on Video being Played

I am new to the world of Open Gl and I have googled a lot but i am unable to find a way to implement Effects on a video being played. After some research i have finally found a class that can be used to play video on a GLSurfaceView. And i know from…
Sheraz Ahmad Khilji
  • 8,300
  • 9
  • 52
  • 84
24
votes
6 answers

How can I use Multiple GLSurfaceView components in the same Layout?

I'm writing an Information Visualization API for Android and ran into a problem trying to place two units of a custom GLSurfaceView into a Layout. The Custom GLSurfaceView at this point is simply an extension of the GLSurfaceView to eliminate…
Rufio
  • 241
  • 1
  • 2
  • 5
20
votes
1 answer

How do I use Android’s “Surface” classes?

Is there a detailed explanation of Surface, SurfaceHolder, EGLSurface, SurfaceView, GLSurfaceView, SurfaceTexture, and TextureView?  In particular: What’s the difference between SurfaceView and TextureView? Do I need to use GLSurfaceView to use…
fadden
  • 51,356
  • 5
  • 116
  • 166
17
votes
6 answers

Android GLSurfaceView transparent background without setZOrderonTop

Sorry for my English. My work is based on https://github.com/harism/android_page_curl/ After many hours of research, I have found a few solutions, but not for all the issues what I have in my application. I've some trouble with a GLSurfaceView. I've…
CharlesD
  • 247
  • 1
  • 3
  • 5
16
votes
0 answers

OpenGL scene with transparent background + native widgets below and above

I'm trying to achieve the following view: If the views were layered (bottom to top): layer 1: basic XML layout (image, buttons etc) layer 2: OpenGL scene with transparent background such that we can see through layer 3: some widgets over the…
mbmc
  • 5,024
  • 5
  • 25
  • 53
15
votes
1 answer

Android camera preview stretched using Grafika CameraCapture code

I'm looking for help with an issue I'm facing using Grafika's CameraCaptureActivity code. I want to build an app that can record camera and display a preview, so this sample and code looked like exactly what I wanted and so far it's been great, this…
Benoit
  • 1,168
  • 8
  • 16
14
votes
1 answer

Recording a Surface using MediaCodec

So, In my application, I am able to show effects(like blur filter, gaussian) to video that comes from Camera using GPUImage library. Basically, I (library) will take the input from the Camera, get's the raw byte data, converts it into RGBA format…
13
votes
2 answers

Using GLSurfaceView class with android xml layouts

I want to make use of the android xml layouts. I have put a glSurfaceView in a frame layout to use in conjunction with a linear layout like so...
Jack
  • 2,625
  • 5
  • 33
  • 56
12
votes
4 answers

Fighting with SurfaceView, Camera and OpenGL

We've been fighting with some problems relating to SurfaceViews for more than a week, and find no proper solution to them. We read the other questions in the forum regarding to similar problems (and even Mixare source code) but couldn't find an…
saricchiella
  • 121
  • 1
  • 3
12
votes
1 answer

How to get width and height of displayed image in android?

This question may seem trivial and been asked many times, but I couldn't find an answer that will work for me. I have an ImageView and GLSurfaceView that is drawn on top of ImageView when I push a button. For my ImageView I pass a Bitmap and scale…
Fedor Tsyganov
  • 992
  • 13
  • 30
11
votes
2 answers

How to properly use setZOrderMediaOverlay on Android?

Like many others, I am trying to draw 3D objects (using GLSurfaceView) on camera preview (using SurfaceView), along with some buttons placed on top. I actually got a prototype working, but I could not get the onResume working correctly. After a…
alokoko
  • 1,405
  • 4
  • 21
  • 35
11
votes
1 answer

Android View vs SurfaceView vs GLSurfaceView for 2D drawing app with Zoomable User Interface

I plan to write a 2D drawing app with a zoomable user interface. With the app the user should be able to transform (translate and scale) drawn paths (and of course the UI). I assume that there will be up to 500 paths at the same time. Now, I am…
1
2 3
35 36