Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7843269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:30:44+00:00 2026-06-02T16:30:44+00:00

I have extended the GLSurfaceView and implemented my own GLSurfaceView.Renderer to create my first

  • 0

I have extended the GLSurfaceView and implemented my own GLSurfaceView.Renderer to create my first relatively simple 2D OpenGLES game for android.

I have been testing my game using the following code on the activities onCreate method which sets the surface view as the content view, from which I have obtained a constant 60fps.

60fps activity :

mGLView = new OpenGLTest1SurfaceView(this);
setContentView(mGLView);

However now I have moved to an XML layout so I can place an admob overlay in the bottom right corner of the screen,

admob xml :

<Frame Layout...
<...OpenGLTest1SurfaceView...
<com.google.ads.adView...

admob activity :

setContentView(R.layout.main);

Now I the application fluctuates between 43fps and 60fps at seemingly random intervals. I have looked at the LogCat and the GC is not running excessively (once every 20seconds or so).

  • Should I have expected a lower frame rate when moving my surface view into an XML layout?
  • Is there an alternative method for showing admob adverts without using an XML layout?
  • Is there anything I could do to identify why my applications FPS lowers at particular times?

Any help would be greatly appreciated because I would like to be able to monetize my OpenGL applications in the near future.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:30:47+00:00Added an answer on June 2, 2026 at 4:30 pm

    GLSurfaceView being a SurfaceView has a little bit different way of being represented in a window.

    “the SurfaceView punches a hole in its window to allow its surface to
    be displayed. The view hierarchy will take care of correctly
    compositing with the Surface any siblings of the SurfaceView that
    would normally appear on top of it. This can be used to place overlays
    such as buttons on top of the Surface, though note however that it can
    have an impact on performance since a full alpha-blended composite
    will be performed each time the Surface changes.”

    First step you need to draw AdMobView in a separate window (layer) on top of your main window.
    Here is an example of how you do it:

    View topLocker = lockDownWindow.getChildAt(0);
    
    WindowManager.LayoutParams windowParams = new WindowManager.LayoutParams();
    windowParams.gravity = Gravity.TOP;
    windowParams.x = 0;
    windowParams.y = 0;
    windowParams.height = WindowManager.LayoutParams.MATCH_PARENT;
    windowParams.width = WindowManager.LayoutParams.MATCH_PARENT;
    windowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
        | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
        | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
    windowParams.format = PixelFormat.TRANSLUCENT;
    windowParams.windowAnimations = 0;
    
    WindowManager wm = getWindowManager();
    wm.addView(yourAwesomView, windowParams);
    

    “yourAwesomeView” here is a layout containing adView. Beware you have to properly configure flags for window to let your touches slip to background window. Also you’re resposible for removing this window.

    Another advice I may have is to try disabling default background in your theme since your GLSurfaceView is on top of it, you don’t want extra draws behind it.

    in your theme add

    <item name="android:windowBackground">@null</item>
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a simple 3-D app for android that will have
I have extended the ASP.NET MVC Html Helper to include my own ValidationImage that
I have extended the android View class, and now I want to define a
Greetings all, I have extended my own QAbstractListModel to change the background color of
I'm using the Android Compatibility library to implement fragments and have extended the layout
I have extended LinearLayout (vertical) to create a custom compound component. This in turn
I have extended my entities to implement specific interfaces for its type. I am
I have extended a server control (not a user control) and put the code
I am trying to draw an animation. To do so I have extended View
I have execute-extended-command bound to alt+a. So when in minibuffer, when i press it,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.