首页 > 解决方案 > 如何创建 android.opengl.EGLContext 对象的实例?

问题描述

我有这个功能(取自 webRTC api):

  public static EglBase createEgl14(
      android.opengl.EGLContext sharedContext) {...}

所以我需要用android.opengl.EGLContext. 我有上下文的句柄(长),但我找不到创建android.opengl.EGLContext对象的方法

当我做:

new EGLContext(myContextHandle) 

我收到

错误:EGLContext(long) 在 EGLContext 中不公开;无法从外部包访问

这是 EGLContext 的实现:

public class EGLContext extends EGLObjectHandle {
    private EGLContext(long handle) {
        super(handle);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof EGLContext)) return false;

        EGLContext that = (EGLContext) o;
        return getNativeHandle() == that.getNativeHandle();
    }
}

标签: androidwebrtc

解决方案


推荐阅读