Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - [GLSurfaceView]Should I update game logics in onDrawFrame()?

[GLSurfaceView]Should I update game logics in onDrawFrame()?

Put your problem here if it does not fit any of the other categories.

[GLSurfaceView]Should I update game logics in onDrawFrame()?

Postby lgmcben » Fri Oct 09, 2009 6:45 am

Hi. Please excuse me for being new. I'll try my best to explain.

I read the Android Developer blog about GLSurfaceView here:

http://android-developers.blogspot.com/ ... penGL%20ES

It said one of the advantage we get from using GLSurfaceView is "Creating and managing a separate rendering thread to enable smooth animation."


Question:

Currently I'm doing this in my game.
public void onDrawFrame(GL10 gl) {

//update game mechanics/physics
updateGame(gl);


//draw game
gl.glDisable(GL10.GL_DITHER);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
.........
}

Is this what it's supposed to be? (I handled 'elapsed time' in my updateGame() )


Or should I create another thread to do the update? Like this:

@Override
public void run() {
while (mRun) {

//update game mechanics/physics
updateGame(gl);

}
}

public void onDrawFrame(GL10 gl) {
//draw game
gl.glDisable(GL10.GL_DITHER);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
.........
}

Which one will produce best result for a game?

Thank you in advance.
lgmcben
Junior Developer
Junior Developer
 
Posts: 24
Joined: Mon Nov 17, 2008 5:06 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 14 guests