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 6026019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:23:03+00:00 2026-05-23T04:23:03+00:00

I have a game using OpenGL. I’ve built off of the examples, for the

  • 0

I have a game using OpenGL. I’ve built off of the examples, for the most part, having the Main Thread, Renderer Thread (GLSurfaceView.Renderer) and added a GameLogic thread as well. When the game is executed, everything seems to run through perfectly. When back is pressed and onPause() is fired, I’m also firing the GLSurfaceView()’s onPause, but I’m having a “crash” at that point. Here’s the MainActivity’s onPause:

@Override
protected void onPause() {
    Log.d("Main", "Pre- Super onPause");
    super.onPause();
    Log.d("Main", "Post- Super onPause");
    mGSGLView.onPause();
    Log.d("Main", "Post- GL onPause");
}

Each log point is reached except the last. In logcat, immediately following the “Post Super onPause” line, I get an Activity pause timeout.

I am not overriding onPause in the GLSurfaceView class… and as far as I know this had been working for me for some time, but recently started occurring when I started getting a completely black screen on the second time I tried to run my game which sits until finally getting an ANR. 95% of my game runs natively. Similar to the San Angeles example, the Renderer calls to onDraw, for instance call a NativeDraw function instead of java. The same is true for the onSurfaceCreated, onSurfaceChanged, and I also call a native GameLogic method in the logic thread (basically all that is called there is a thread sleep and that logic method.)

I hope I’ve given enough information, please let me know if there is anything else I should be providing.

EDIT – Well… I’ve actually narrowed down the issue to a native function call where I’m freeing certain pointers that had previously had memory allocated for them with malloc(). My code there looks okay, but if I omit the call, everything works okay, so my free() calls must be corrupting something…

  • 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-05-23T04:23:04+00:00Added an answer on May 23, 2026 at 4:23 am

    Okay, I’m only answering this myself because the solution was so specific to my own code that no one would have been able to.

    If you have memory allocated on the native side, take care not to free it until after you are sure no other code will be trying to access it.

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

Sidebar

Related Questions

I'm building a 2d game engine using c++ and opengl. Now i have implemented
I'm currently developing a game for Android using OpenGL ES 2.0. I have almost
I am trying to make a simple pong game using opengl-es. I have checked
I have my own game engine using C++ and OpenGL, but I have models
I'm using C++ and OpenGL to make a basic 2D game, I have a
I have made a multiplayer game using the GameKit Framework where 2 iPhones/iPods can
I have a simple tank wars style game using the allegro open source library.
I have am writing a small game using Applet. I want to be able
I'm working on a game (using Ruby) and planning to have it available in
i m trying to design a mmo game using python... I have evaluated stackless

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.