Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my old game based on canvas and bitmaps I used surfaceHolder and Thread to call onDraw:

public class GameThread extends Thread {
private SurfaceHolder _surfaceHolder;
private ScreenObjectsView _panel;
private boolean _run = false;

public static int mOnDrawPeriodGap = 20;

public GameThread(SurfaceHolder surfaceHolder, ScreenObjectsView panel) {
    _surfaceHolder = surfaceHolder;
    _panel = panel;

public void setRunning(boolean run) {
    _run = run;

public SurfaceHolder getSurfaceHolder() {
    return _surfaceHolder;

public void run() {
    Canvas c;
    while (_run) {


        c = null;
        //Log.e("test","thread running");
        try {
            c = _surfaceHolder.lockCanvas(null);
            synchronized (_surfaceHolder) {

                /** onDraw() method  run too fast, lets slower it*/
                try {
                } catch (InterruptedException e) {
        } finally {
            // do this in a finally so that if an exception is thrown
            // during the above, we don't leave the Surface in an
            // inconsistent state
            if (c != null) {


Today I try to adapt my game to openGL 2D. I'm new in openGL world.

Do I need to do the same for new framework?

As I know It (openGL) seems already starts a second thread for rendering, calling into the Renderer methods.

Thank you,

share|improve this question

closed as off-topic by Anko, Seth Battin, Trevor Powell, Byte56 Mar 12 '14 at 14:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about "how to get started," "what to learn next," or "which technology to use" are discussion-oriented questions which involve answers that are either based on opinion, or which are all equally valid. Those kinds of questions are outside the scope of this site. Visit our help center for more information." – Seth Battin, Byte56
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.