English 中文(简体)
Nexus One GL_FRAMEBUFFER_OES扩展……实际上不存在?
原标题:Nexus One GL_FRAMEBUFFER_OES Extension... Not actually there?

我正在将iPhone应用移植到Android,需要使用OpenGL帧缓冲区。我有一个Nexus One,调用glGet(GL_EXTENSIONS)的时候显示Nexus One支持与iPhone相同的帧缓冲区扩展。但是,我似乎无法在我的GLSurfaceView中调用与OpenGL扩展相关的函数。当我调用简单的帧缓冲获取函数时,我会收到一个UnsupportedOperationException。

我似乎无法解决这个问题,但是我必须拥有帧缓冲才能继续开发。在创建OpenGL上下文时,我需要传递一些选项来获取一个完全可用的OpenGL上下文对象吗?这是我正在尝试运行以确定硬件能力的代码块。它声称支持扩展,我的gl对象是GL11ExtensionPack的一个实例,但是调用glGetFramebufferAttachmentParameterivOES会导致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");
        }
    }
}

如果有人成功地使用GL_FRAMEBUFFERS_OES扩展,请告诉我。我开始觉得它可能只是在Java API中没有实现!

问题回答

目前Android存在一个bug,即这些函数的Java版本未实现。目前使用这些扩展函数的唯一方法是使用NDK。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签