I read a lot of articles about it but cannot clearly understand one very important issue. So, for example, I wrote a program (in Java) which used OpenGL API (included package containing this API) after it compiled my program to execute in Dalvik. And how this byte code communicates with opengles.so? When does this communication appear?

有帮助吗?

解决方案

Correct me if I'm wrong, since the following is only a guess:

Android framework is shipped with a set of Java classes, which implement OpenGL functionality. This Java classes would just call native OpenGL function through JNI, thus, leveraging native OpenGL libraries.

If you look at Android framework sources, you can see following:

public class GLES20 {

    public static native void glClearColor(
            float red,
            float green,
            float blue,
            float alpha
        );

        // C function void glClearDepthf ( GLclampf depth )

        public static native void glClearDepthf(
            float depth
        );

        // C function void glClearStencil ( GLint s )

        public static native void glClearStencil(
            int s
        );
        // More functions
}

So, I think it's just JNI. It's all open source, just go there and take a look.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top