开发者

Nexus One GL_FRAMEBUFFER_OES Extension... Not actually there?

I'm porting an iPhone app to Android, and I need to use OpenGL framebuffers. I have a Nexus One, and a call to glGet(GL_EXTENSIONS) shows that the Nexus One supports the same framebuffer extension as the iPhone. However, I can't seem to call functions related to the OpenGL extension in my GLSu开发者_如何学PythonrfaceView. When I call a simple framebuffer get function, I get an UnsupportedOperationException.

I can't seem to resolve this issue, and I must have framebuffers to continue development. Do I need to pass some options in when the OpenGL context is created to get a fully capable OpenGL context object? Here's the block of code that I'm trying to run that determines the capabilities of the hardware. It claims to support the extension and my gl object is an instance of GL11ExtensionPack, but the call to glGetFramebufferAttachmentParameterivOES fails with an UnsupportedOperationException.

public void runEnvironmentTests()
{
    String extensions = gl.glGetString(GL11.GL_EXTENSIONS);
    Log.d("Layers Graphics", extensions);

    if (gl instanceof GL11ExtensionPack) {
        Log.d("Layers Graphics", "GL11 Extension Pack supported");

        GL11ExtensionPack g = (GL11ExtensionPack) gl;
        int[] r = new int[1];
        try {
            g.glGetFramebufferAttachmentParameterivOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES,     GL11ExtensionPack.GL_COLOR_ATTACHMENT0_OES, L11.GL_TEXTURE_2D, r, 0);
            Log.d("Layers Graphics", "Framebuffers are supported");

        } catch (UnsupportedOperationException e) {
            e.printStackTrace();
            framebuffersSupported = false;
            Log.d("Layers Graphics", "Framebuffers are NOT supported");
        }
    }
}

If anyone has successfully used the GL_FRAMEBUFFERS_OES extension, please let me know. I'm beginning to think it may just not be implemented in the Java API!


There's currently a bug in Android in which the Java versions of these functions are unimplemented. The only way to use these extension functions at the moment is to use the NDK.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜