Game Development Reference
In-Depth Information
As you can see in the preceding code example, rendering to an FBO is just a matter
of calling its
begin()
method to temporarily redirect all subsequent draw calls to the
FBO's texture buffer. The rendering to an FBO must always be finished by calling its
end()
method. Afterwards, the resulting texture can be retrieved by simply calling
the
getColorBufferTexture()
method.
In order to work with FBOs, your device needs GLES 2.0
hardware support. For simplicity, we assume full hardware
support for GLES 2.0 in this topic.
We will now make some mandatory changes to our platform-specific projects
wherever needed to enable the OpenGL ES 2.0 mode so that we can use FBOs.
For the Android platform, make the following changes to the
AndroidManifest.xml
file of the
CanyonBunny-android
project:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.packtpub.libgdx.canyonbunny"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-feature android:glEsVersion="0x00020000"
android:required="true" />
...
</manifest>
The
android:glEsVersion
value is used to specify the OpenGL ES version
required by the app. To specify OpenGL ES version 2.0, you would set the
value as
0x00020000
.
For the iOS platform, make the following changes to the
Info.plist.xml
file of the
CanyonBunny-robovm/CanyonBunny-ios
project:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.
apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
...
<key>UIRequiredDeviceCapabilities</key>
<array>