Is this normal??

Problems with Canvas, OpenGL, etc...

Is this normal??

Postby yaj786 » Fri Jun 04, 2010 5:47 am

Maybe I'm missing something, but us it normal for a thread to be going this slowly??

I'm getting only around 65 cycles/second... is that how slow a surfaceview is? Notice that I'm not doing ANYTHING, all of my functions are commented out. The only thing is a few if else statements, and the lock and unlocking of hte canvas.

Code: Select all
while(mRun)
      {
         double diff = (System.currentTimeMillis() - lastTouchTime)/1000.0;
         Log.i(TAG,"cycles/sec:"+1.0/diff);

         lastTouchTime = System.currentTimeMillis();
         
            Canvas c = null;
            try {

                c = mSurfaceHolder.lockCanvas(null);
                synchronized (mSurfaceHolder) {
                    if (gameState == GAME_STATE_RUNNING)
                    {
                       //updateLandscape();
                       //updatePhysics();
                    }
                    else if(gameState == GAME_STATE_WON_LEVEL)
                    {
                       
                    }
                    else if(gameState == GAME_STATE_PAUSE)
                    {
                       
                    }
                   //doDraw(c);
                }
            } 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) {
                    mSurfaceHolder.unlockCanvasAndPost(c);
                }
            }
           
           
      }
yaj786
Developer
Developer
 
Posts: 33
Joined: Fri Jul 10, 2009 7:37 am

Top

Re: Is this normal??

Postby impi » Sat Jun 05, 2010 3:22 pm

This is vsync. 65 FPS probably because of rounding errors or something. This should be 60 FPS, because the screens refreshrate is 60.
impi
Developer
Developer
 
Posts: 29
Joined: Wed Apr 28, 2010 11:17 pm

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 4 guests