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

  • Home
  • SEARCH
  • 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 8780515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:04:16+00:00 2026-06-13T20:04:16+00:00

I’m building an openGL ES 2 game, with Java on Android. I currently have

  • 0

I’m building an openGL ES 2 game, with Java on Android.

I currently have two threads. The Android UI and openGL.

As far as I understand it, to get the best performance, I need to have another thread for game logic, so the openGL thread can render as fast as possible.

This would leave me with 3. The Android UI, openGL and Game Logic. (Let’s call them UI, OGL and GL.)

Correct me if I’m wrong:

UI starts, makes OGL, and GL.
OGL and GL run, querying UI for input.
GL sends draw calls to the queue in OGL.

There are two cases here.
If GL takes longer to loop than OGL, the next loop of OGL needs to wait for GL to finish before starting it’s next loop, as to avoid only rendering half of the calls for last frame.
If OGL takes longer than GL, GL needs to wait until OGL is done to start again/send more draw calls.

To accomplish this:

When GL is done with it’s loop, it checks OGL to see if it’s done drawing the current queue of draw calls. If so, it starts both GL and OGL’s next loop. If not, it waits.

When OGL is done, it checks GL. If GL is done, it starts both loops again. If not, it waits for GL, which when done will check OGL, and start both again.

Sorry if this is a little confusingly worded..

To illistrate my idea:

diagram http://img840.imageshack.us/img840/2816/stackoverflowthredpictu.jpg

To clarify me question:
-Will laying things out this way work?
–If not, what would work better?

-What specific subjects should I look up to accomplish this?
–ie I don’t know how to make threads or send information between them.

This is my first time asking a question here, hope I did it correctly. 🙂
Thanks!

  • 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-13T20:04:18+00:00Added an answer on June 13, 2026 at 8:04 pm

    -Will laying things out this way work? –If not, what would work better?

    Yes, but this strategy may create more complexity than necessary. It’s easy to deadlock two threads when they have to wait for one another.

    I think you could use RENDERMODE_WHEN_DIRTY:

     setRenderMode(RENDERMODE_WHEN_DIRTY);
    

    In that mode, your renderer will render a frame only when (1) the surface is created or (2) you call requestRender(). So, your game logic thread would call queueEvent() (or similar) to push drawing calls to the renderer, and then call requestRender() at the end of the game logic loop.

    If you still find that the game logic thread needs to wait for the renderer to finish, you could create a Semaphore in the game logic thread that will block it until the renderer signals (by calling release() on the Semaphore) that it’s finished rendering the frame.

    Disclaimer: I’m not a game developer, but hopefully this gives you some paths to explore.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

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.