4

I want to use eglPresentationTimeANDROID in my ExtendedGLSurfaceView (extended from GLSurfaceView).

The method appears in:

EGLExt.eglPresentationTimeANDROID(android.opengl.EGLDisplay display, android.opengl.EGLSurface surface, long time);

My main issue is that GLSurfaceView uses EGLDisplay, EGLContext and EGLSurface from javax.microedition.khronos.egl. However, eglPresentationTimeANDROID takes EGLDisplay and EGLSurface from android.opengl.EGLDisplay

Is there is any quick fix? Or do I need to redo all my ExtendedGLSurfaceView to use android.opengl classes?

Pavneet_Singh
  • 36,884
  • 5
  • 53
  • 68

1 Answers1

1

I don't think it matters. IIRC, it all turns into the same thing under the hood. The EGL10 and EGL14 classes are just different interfaces to the underlying native code.

I can't guarantee that this will always be the case, though, so it's safer to update your code to the newer version. EGL14 has been around since API 17 (Android 4.2), and I think recent Android is using EGL 1.5. This code was implemented twice, with EGL 1.0 and 1.4, so it can serve as a porting example.

FWIW, you may find this answer of interest.

Community
  • 1
  • 1
fadden
  • 51,356
  • 5
  • 116
  • 166
  • How does it not matter? The method requires one type and the author uses another. Can you cast one to the other? If so how? – Maverick Meerkat Feb 18 '19 at 13:27
  • @DavidRefaeli: the Java-language EGL classes are just thin wrappers around native objects. Calling `eglGetCurrentContext()` or `eglGetCurrentSurface()` will return an EGL10 object if called through one set of interfaces, or an EGL14 object if called through a different set. You can't cast the Java objects to each other directly, but the set of calls you use to access the underlying EGL object doesn't have to match what was used to create them. – fadden Feb 23 '19 at 16:03