Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Holland

Member Since 27 Jan 2008
Offline Last Active Jun 14 2012 12:07 AM
-----

Topics I've Started

Android + OpenGL ES...double buffered? threaded? gameloop?

30 April 2012 - 05:11 PM

3 questions...but first, here's my setup

My activity class:
...useless stuff...
import android.opengl.GLSurfaceView;

public class MyApp extends Activity
{
	private GLSurfaceView mSurfaceView;
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE); //fullscreen
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
		glSurfaceView = new GLSurfaceView(this);
		glSurfaceView.setRenderer(new MyRenderer());
		setContentView(glSurfaceView);
	}
}

My Renderer class
...unimportant stuff...
import android.opengl.GLSurfaceView.Renderer;
public class MyRenderer implements Renderer
{
	@Override
	public void onDrawFrame(GL10 gl)
	{
		...iterate over draw objects and call .draw() on them...
	}
}
...more unimportant stuff...

1) Is OpenGL ES double buffered by default?
Right now, I've created a Renderer class that extends GLSurfaceView.Renderer. From that, I've got an override for onDrawFrame...like you can see above. Is this already double buffered? I've done a little bit of OpenGL coding for PC and I remember having to specifically tell it to swap buffers...

2) Given my current setup, is the renderer already on its own thread? Is that something handled by OpenGL ES (or the GLViewPort class)?

3) Right now I'm doing everything inside of the onDrawScene(GL10 gl) function. Is there a better way of creating a game loop? Seems like (assuming rendering is currently on its own thread), onDrawScene should just iterate of my drawable objects and draw them, but I should probably have a loop in another thread somewhere polling input, updating drawable object positions, etc. Any thoughts?

Thanks, in advance, for the help!

[Edit: spelling error]

Objective C book

21 July 2011 - 04:52 PM

Looking for recommendations on books (physical, actual books...not web sites please) that are based around Objective C programming for the already experience C/C++/C# programmer. All of the books I've found on Amazon are for people who have never programmed before. I have programmed for a number of years, in the gaming industry. I just want a nice book to use as reference and to get me started with Objective C goodness.

Any suggestions?

Thanks!

PARTNERS