Error in sample code : [hello-gl2]

247 views
Skip to first unread message

EdwardComb

unread,
May 4, 2011, 12:40:03 AM5/4/11
to android-ndk
Hi everyone,

I am new in Android NDK and just discover it in the past few days.
I have installed cygwin and android-ndk-r5b in my development machine.
So, I want to start with the sample code given, running on emulator.

This is what I've done:

1) Open the hello-gl2 project directory in cygwin terminal
2) Run /cygdrive/c/android-ndk-r5b/ndk-build and I got:
Install : libgl2jni.so => libs/armeabi/libgljni.so
3) Using Eclipse, File --> New --> Android Project --> Create project
from existing source --> Choose the hello-gl2 project directory -->
Finish


I managed to do it for hello-jni, two-libs and san-angeles. But, I
have the problem with
the hello-gl2. I got 2 errors in the code in src/GL2JNIView.java


private void init(boolean translucent, int depth, int stencil) {
....
setEGLContextFactory(new ContextFactory()); <---- Error: the
method is undefined for the type GL2JNIView
}


private static class ContextFactory implements
GLSurfaceView.EGLContextFactory { <----
Error:GLSurfaceView.EGLContextFactory cannot be resolved to a type
....
public EGLContext createContext(EGL10 egl, EGLDisplay display,
EGLConfig eglConfig) {
.....
}
}



Did anybody got this problem before?

Thanks in advance.

mic _

unread,
May 4, 2011, 3:05:40 AM5/4/11
to andro...@googlegroups.com
I don't know why you got those build errors, but even if you didn't the emulator currently doesn't support OpenGL ES 2.0. You'd need to run that app on some Android device that supports 2.0+.

/Michael


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


EdwardComb

unread,
May 4, 2011, 8:37:16 PM5/4/11
to android-ndk
Thanks Mic for your helpful information.
One more simple question, is it all OpenGL ES 2.0 unable to run in
emulator?
> >http://groups.google.com/group/android-ndk?hl=en.- Hide quoted text -
>
> - Show quoted text -

alan

unread,
May 5, 2011, 4:23:40 AM5/5/11
to andro...@googlegroups.com
yes opengles 2.0 is completely unsupported

EdwardComb

unread,
May 5, 2011, 7:49:34 PM5/5/11
to android-ndk
em, anyone know where should I start for my opengl es using NDK.
most of the web that i found just describe about opengl es in SDK..?

mic _

unread,
May 6, 2011, 1:20:15 AM5/6/11
to andro...@googlegroups.com
The concepts of OpenGL ES don't change because you use a C binding rather than a Java one. You could start with the hello-gl2 example and gradually expand it.

If you don't want to buy an OpenGL ES 2.0-enabled device to test on, you could download the PowerVR SDK and play around with that. It won't be Android then, but you'd at least be able to test your rendering code.

/Michael

On Fri, May 6, 2011 at 1:49 AM, EdwardComb <dzn.a...@gmail.com> wrote:
em, anyone know where should I start for my opengl es using NDK.
most of the web that i found just describe about opengl es in SDK..?

EdwardComb

unread,
May 8, 2011, 8:56:11 PM5/8/11
to android-ndk
Thanks mic for your suggestion again..

And yeah, i got this thing solved.

Last time, when I created a new Android project in eclipse, by
default, Android 1.6 have been chosen for me.
But, I tried to change to Android 2.2 emulator. And yeah, I got no
more errors.

And exactly like you said last time, I cannot run it on the emulator.
At least now, I can start with OpenGL ES..

Reply all
Reply to author
Forward
0 new messages