Note that there are some explanatory texts on larger screens.

plurals
  1. PO3 Android Threads, how to structure
    primarykey
    data
    text
    <p>I'm building an openGL ES 2 game, with Java on Android.</p> <p>I currently have two threads. The Android UI and openGL.</p> <p>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.</p> <p>This would leave me with 3. The Android UI, openGL and Game Logic. (Let's call them UI, OGL and GL.)</p> <p>Correct me if I'm wrong:</p> <p>UI starts, makes OGL, and GL. OGL and GL run, querying UI for input. GL sends draw calls to the queue in OGL.</p> <p>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.</p> <p>To accomplish this:</p> <p>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.</p> <p>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.</p> <p>Sorry if this is a little confusingly worded..</p> <p>To illistrate my idea:</p> <p><a href="http://img840.imageshack.us/img840/2816/stackoverflowthredpictu.jpg" rel="nofollow noreferrer">diagram http://img840.imageshack.us/img840/2816/stackoverflowthredpictu.jpg</a></p> <p>To clarify me question: -Will laying things out this way work? --If not, what would work better?</p> <p>-What <em>specific</em> subjects should I look up to accomplish this? --ie I don't know how to make threads or send information between them.</p> <p>This is my first time asking a question here, hope I did it correctly. :) Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload