English 中文(简体)
Android 露 Android角ES 孔波弗ffer,使案文更加深入。
原标题:Android OpenGL ES Framebuffer objects - rendering depth-buffer to texture

我正在使用一种装有Froyo的 Android装置,支持开放式GES 1.1和开放式GES2.0。

我想给案文留下深刻的缓冲。 在其他平台(包括“i”)上,我看到了一些开放式的GL、开放式的ES。

我似乎能够看到一个带有颜色的排行,但每当我附上一个深度的文本,它就失败了。

我目前的法典以http://www.fabiensanglard.net/shadowmapping/index.php为基础。 这个例子,但同时也会产生一种彩色文字,而不是 setting取和阅读缓冲。

是否有一个简单的例子来把开放式的利比里亚ES FBO都安装在文体上? 或者,还有一份文件描述了哪些是、哪些是没有支持的?


由于这些评论,我特别需要ES1.1的解决办法,如果能够找到解决办法,并在安康开展工作。 我也想看一下ES 2——我不相信我会理解把深度信息包装到彩色缓冲的想法——我能看一看是否更好理解这个想法?

关于守则——我的消息来源与我上述联系几乎没有区别。 脆弱的状况是,它不是完整的。


由于碎裂的建议,我现在就有了想法。 如果我能够找到另一种解决办法,那么我会看一下。 我的理想是同时获得深度和彩色——如果我能够帮助的话,不会真正想要使肤色和深度分开。

问题回答

缩略语 必须在第2.2条与开放式利比里亚经济体系中开展工作:

    // Create a frame buffer
    glGenFramebuffers( 1, &(frame_buffer ) );

    // Generate a texture to hold the colour buffer
    glGenTextures(1, &(colour_texture) );
    glBindTexture(GL_TEXTURE_2D, colour_texture);
    // Width and height do not have to be a power of two
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
            pixelWidth, pixelHeight,
            0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

    // Probably just paranoia
    glBindTexture(GL_TEXTURE_2D, 0);

    // Create a texture to hold the depth buffer
    glGenTextures(1, &(depth_texture) );
    glBindTexture(GL_TEXTURE_2D, depth_texture);

    glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
            pixelWidth, pixelHeight,
            0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, NULL);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

    glBindTexture(GL_TEXTURE_2D, 0);        

    glBindFramebuffer(GL_FRAMEBUFFER, frame_buffer);

    // Associate the textures with the FBO.

    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                    GL_TEXTURE_2D, colour_texture, 0);

    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
                    GL_TEXTURE_2D, depth_texture, 0);

    // Check FBO status.    
    GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);

    if ( status == GL_FRAMEBUFFER_COMPLETE )
    {
        // Success
    }

很现实的是,遵循公开的GLES2手册,并按正确顺序做一切。

将这一点与开放式信用证ES1.1合并起来,将紧急救援行动并入必要的职能电话,并将自缓冲物体设计以来的固定装置再使用。 任何在框架中加上深度案文的企图都导致缓冲区内的一个不完整的缓冲物体。

因此,在我得出结论时,这并不与开放的欧安论坛ES1.1合作,但显然与ES2.2合作。

如果任何人都找到了ES1.1的解决办法,那将令人感兴趣。

在许多装置中,向深度投放的字塔没有得到支持。 你们需要为你的深度缓冲带 render。





相关问题
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 ...

热门标签