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

How to interrupt GLSurfaceView rendering phase and start a new one?

Hi Android Developers, What is the best way to interrupt a current rendering phase of GLSurfaceView and start a new one when mode is equal to "Render_when_dirty"? I artificially stop rendering in "onDraw" method by checking a flag and returning from…
iliTheFallen
  • 466
  • 7
  • 16
0
votes
1 answer

Synchronize a GLSurfaceView with a MapView (Google Map API v2)

Is it possible to render some OpenGL objects in a GLSurfaceView on top of a MapView and place them with latitude and longitude (synchronize the 2 surfaces). I would probably need to convert latitude and longitude to screen location but is that…
Fr4nz
  • 1,616
  • 6
  • 24
  • 33
0
votes
2 answers

How does GLSurfaceView connect with surfaceflinger?

Recently I am confused with GLSurfaceView. In java level, it use glsurfaceview and how it connect with surfaceflinger? thanks james.
james
  • 335
  • 1
  • 5
  • 18
0
votes
1 answer

GLThread or GLSurfaceview overlapping issue?

There are 2 GLSurfaceViews in my application(android, opengles 2.0). Two of them are overlapped so i can use top of it as a preview. My Problem is when i launch the app the top glsurfaceview`s contents are disappeared(i set a different background…
0
votes
2 answers

Android setting background to fit screen size using cocos2d

I am using cocos2d to develop my android game.I am using following code to set background of screen. CGSize winSize = CCDirector.sharedDirector().displaySize(); CCSprite player = CCSprite.sprite("map_image.png"); …
Swapnil
  • 2,409
  • 4
  • 26
  • 48
0
votes
1 answer

Memory leak in Basic GLSurfaceView for android

I've put together something I call a "ViewManager" from a few OpenGL/Android tutorials. The problem is that I am having a memory leak. I get a GC notification every once in awhile and I don't think I am doing anything. 11-23 01:50:34.435:…
Matthew
  • 3,886
  • 7
  • 47
  • 84
0
votes
2 answers

open gles basic class structures

I have four classes to understand opengles at my first opengles education: myRenderer myGLSurfaceViev myActivity myTriangle I want to get touch events on my surface.. but after ı set myRenderer, ı see my triangle on the screen but ı cant…
0
votes
1 answer

How to get right values from Views touch event

I have a problem with implementing touch events on GLSurfaceView. Views size is 1280x696, because of android (tablet) status bar at bottom with soft keys, time etc.., (screen resolution is 1280x800), but OnTouchListener is receiving touch events…
Pinker
  • 65
  • 8
0
votes
1 answer

Nexus 7 backspace keypress not coming in GLSurfaceView

I have a class that extends GLSurfaceView. I have handled keyevents for this surface view. All keys work fine on all other devices except Nexus 7 In Nexus 7 backspace keypress on inbuilt keyboard is not giving event. But if third party keyboard is…
chin87
  • 498
  • 4
  • 18
0
votes
1 answer

OpenGL and Camera Preview - premultiplied alpha - blending together gets “over saturated” color

Okay here is my OpenGL Problem I really can't fix. Everything works fine on the Galaxy S1 and on an S2 which seems to have almost the same GPU. But when I try to make an AR-App I always get a problem with transparent pixels on top of my camera…
0
votes
1 answer

If my GLSurfaceView app never needs to read the Android device's locale, can I safely ignore locale config changes?

By default, if the user changes the display language of their device while my app is running, Android will destroy then recreate the Activity. It does this to be sure my app is correctly using the latest settings. I can override this behaviour by…
tenpn
  • 4,556
  • 5
  • 43
  • 63
0
votes
1 answer

Android, opengl, move glsurfaceview

I have created glsurfaceview in xml file, I'd like to change X,Y of this glsurfaceView when the button is pressed. I have onSurfaceChanged() method and there are x,y variables. can I call this method for chane glsurfaceview position? if I can, how…
aptyp
  • 251
  • 1
  • 6
  • 19
0
votes
1 answer

android - Should I use GLSurfaceView instead of Canvas to avoid bitmapfactory oom?

My app needs to load a building floorplan and then draw objects (furniture) on the floorplan. The floorplan image is a 2500 x 1500 240Kb PNG, but frackin' BitmapFactory crashes most devices by requiring 12+Mb of heap to create the bitmap, giving me…
0
votes
1 answer

View1 disappears after View2.setvisibility(view.INVISIBLE) just on Android 4.0

in my APP I got a gametaskbar which holds specific gamecontrols (control_1, control_2). Additionaly I have two Buttons (Button_1, Button_2) where I can switch visibility. Because I have a lot of UI-Changes, I do this visibility-switching in…
0
votes
1 answer

OpenGL es 1.0 or 2.0 for 2d drawing

I've written an app using a SurfaceView. It appears that one thing that is reducing the framerate of the app is that it takes a while to draw some bitmaps, and also that it takes some time to draw a few lines and circles using the canvas. I want to…
Andi Jay
  • 5,882
  • 13
  • 51
  • 61
1 2 3
35
36