Game Development Reference
In-Depth Information
JNIEXPORT void JNICALL
Java_com_packtpub_ndkcookbook_app13_App13Activity_DrawFrame(
JNIEnv* env, jobject obj )
{
Invoke our platform-independent frame rendering callback:
OnDrawFrame();
}
Now we can put out rendering code in the OnDrawFrame() callback and use it on Android.
There's moreā€¦
To use the previously discussed code, you have to add this line into the AndroidManifest.
xml ile:
<uses-feature android:glEsVersion="0x00020000"/>
Furthermore, you have to link your native application with either OpenGL ES 2 or the OpenGL
ES 3 library. Put the -lGLESv2 or -lGLESv3 switch into your Android.mk ile, like this:
LOCAL_LDLIBS += -lGLESv2
There is a third possibility to do it. You can omit static linking, open the
libGLESv2.so shared library via the dlopen() call, and retrieve
pointers to OpenGL functions using the dlsym() function. This is useful if
you are developing a versatile renderer for OpenGL ES 2 and OpenGL ES 3,
and want to tune everything at runtime.
See also
F Unifying the OpenGL 3 core proile and OpenGL ES 2
Unifying the GLSL 3 and GLSL ES 2 shaders
OpenGL 3 provides support for OpenGL Shading Language. In particular, OpenGL 3.2 Core
Proile supports the GLSL 1.50 Core Proile. On the other hand, OpenGL ES 2 provides
support for GLSL ES Version 1.0, and OpenGL ES 3 supports GLSL ES 3.0. There are minor
syntax differences between these three GLSL versions, which we have to abstract in order to
write portable shaders. In this recipe, we will create a facility to downgrade desktop OpenGL
shaders, to become shaders compatible with OpenGL ES Shading Language 1.0.
 
Search WWH ::




Custom Search