After asking around a bit on the #libgdx IRC, the function Gdx.gl.glViewport( int x, int y, int width, int height )
was pointed out to me. So you only need one camera. Just set the viewport for the left side of the screen then perform your drawing commands, then set up the viewport for the right side of the screen and draw again. like so:
@Override
public void render( float delta )
{
/*Wipe Screen to black*/
Gdx.gl.glClearColor( Color.BLACK );
Gdx.gl.glClear( GL10.GL_COLOR_BUFFER_BIT );
/*Left Half*/
Gdx.gl.glViewport( 0,0,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() );
//Set up camera with viewport in mind
draw( delta );
/*Right Half*/
Gdx.gl.glViewport( Gdx.graphics.getWidth()/2,0,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() );
//Set up camera again with other viewport in mind
draw( delta );
}
You just need to set up the camera so that it is being positioned and transformed to the limited screen the way you want instead of the whole screen. You could potentially also use a 2nd camera.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…