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
0
votes
1 answer

Android glsurfaceview, should collision testing and "ai movement" calculations be performed using asynctask?

I remember reading, in regards to a standard canvas based surfaceview, that one would want to use asynctask to offload major operations from the main thread (for instance NPC movement and attached collision) I could see this working well, with the…
Werner
  • 769
  • 2
  • 6
  • 19
0
votes
1 answer

What is the best method to draw 2D components under an OpenGL ES View in Android?

I'm looking to develop a game for Android using minimal 3D effects, but with mainly 2D graphics. I would prefer not to deal with OGLES Ortho projections and just stick with the simple 2D Canvas drawing provided by the Android SDK but everywhere I…
0
votes
1 answer

Android clip/crop view content

I'm currently in the process of porting an existing iOS app over to Android and have run into a snag where I need to crop the contents of a view in my layout. In iOS I was simply accessing the layer of the view and then setting layer.contentsRect…
jkulisic
  • 309
  • 2
  • 4
  • 13
0
votes
2 answers

where to put the getting of uniform location and attribpointer? draw vs surface created?

I have some code that is very the same on the sample on android dev website. I must quite confuse as to why some programmers or tutorials put the getting of uniform location and the setting of attribporinter GLES20.glUseProgram(mProgram); …
gamdevNoobie
  • 357
  • 1
  • 3
  • 8
0
votes
1 answer

How to change 3D objects when button was clicked on android?

May I know how to I change the 3D object in the GLSurfaceView when the button was clicked? My application keep closing whenever I run it on my device. I have 2 classes which implements GLSurfaceView.Renderer which is LessonOneRenderer and…
AuroraBlaze
  • 421
  • 2
  • 8
  • 25
0
votes
1 answer

glsurfaceview enlarge to the screen width on device rotation

I have a GLSurfaceview in a fragment, it is working ok. When I rotate the device I receive onPause, send it to glsurfaceview and remove it from the parent. Before receiving onResume the image is painted in the new orientation, enlarged to fill all…
0
votes
2 answers

Want to apply pinch and zoom to GLSurfaceView(3d Object)

I am using rajawali library for loading .obj file. My .obj rendering perfectly fine but not able to apply pinch and zoom functionality to it.
Dhrupal
  • 1,863
  • 1
  • 23
  • 38
0
votes
1 answer

GLSurfaceView: position of camera, looking at Surface, changes with android version?

Here is my problem: I have a GLSurfaceView with Renderer and stuff. Everything works just as I wanted, on older Android versions. But on newer versions (I guess > 4.X) it just shows a black screen without any Bitmaps. For example if I use…
0
votes
1 answer

Incorrect GLSurfaceView positioning

I have a GLSurfaceView with a renderer assigned to it. On this view, I draw images which seem to be offset to the left compared to where I have requested that they be drawn on it. This problem has only arisen since I switched from Canvas-based…
Kavan
  • 340
  • 2
  • 12
0
votes
1 answer

Layout on top of GlSurfaceView disappears and appears on its own

I have a GLSurfaceView that is rendering an image as a texture. I have attached a GestureDetector to the GLSurfaceView. When the user taps the screen i want to display a linear layout on top of the GLSurfaceView. Currently when the user taps the…
codeNinja
  • 1,442
  • 3
  • 25
  • 61
0
votes
1 answer

GLThread not starting when calling onResume on GLSurfaceView

I'm writing a game in OpenGLES 1.1 (Using Android static API (GLES11)), and everytime my game activity goes to background (press Home), it comes back in a black screen. I know that the textures and resources have been lost, but the main issue is…
0
votes
1 answer

Android Open GL ES Textures messed up

I have an own method to draw images. It uses Vertex and UVBuffers. I draw like the following: SpriteBatch.Begin(blendMode) <- sets up blending SpriteBatch.Draw(parameters) <- add vertices to the list of vertex arrays SpriteBatch.End() <- Sets up…
Daniel Sharp
  • 169
  • 1
  • 2
  • 12
0
votes
1 answer

how to invoke customview class methods into GLSurfaceview Class

I want to add the scrollTo() and scrollBy() to GLSurfaceview class. This two methods are from the View class. Is it possible to invoke the above two methods on GLSurfaceview class? Why? Because I want to scroll the GLSurfaceview. My Code is HERE
harikrishnan
  • 1,985
  • 4
  • 32
  • 63
0
votes
1 answer

GLSurfaceView over SurfaceView

I need to have a GLSurfaceView over a Surface view. GLSurface view will have a Renderer and SurfaceView will be camera view. Following is my layout
blganesh101
  • 3,647
  • 1
  • 24
  • 44
0
votes
3 answers

Memory overflow when loading large textures

I have a GLSurfaceView and a Renderer which loads textures in onSurfaceCreated. My textures are created like so : public Texture3D(final GL10 gl, final int id) { _pBitmap = BitmapFactory.decodeResource(Utils.getResources(), id); …
Fr4nz
  • 1,616
  • 6
  • 24
  • 33