Hi,

I'm starting to learning OpenGL ES 2 to write app's for Android using the Android NDK. Maybe Android isn't the best system to start learning this, but most of the time I have for this kind of stuff I'm not at home, so learning it on my Android device is currently the only reasonable way for me to learn it.

I try to initialize EGL in my main.c file, but in the line

display = eglGetDisplay(EGL_DEFAULT_DISPLAY);

I get some compile warnings and errors:
- warning: data definition has no type or storage class
- error: conflicting types for 'display'
- note: previous definition of display was here (pointing to the
line with this code: EGLDisplay display;
- warning: initialization makes integer from pointer without a cast
- error: initializer element is not constant

Here is the source of my main.c file:

#include <jni.h>
#include <errno.h>

#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>

#include <android/log.h>
#include <android_native_app_glue.h>

EGLint majorVersion;
EGLint minorVersion;
EGLDisplay display;

display = eglGetDisplay(EGL_DEFAULT_DISPLAY);

if(display == EGL_NO_DISPLAY)
{
// Unable to open connection to locale windowing systen
}

if(!eglInitialize(display, &majorVersion, &minorVersion)
{
// Unable to initialize EGL.
}


Can someone please tell me, what I'm doing wrong and how to fix it?