小编Beb*_*ina的帖子

Android NDK OpenGL ES 2上下文初始化

尝试使用android-ndk-r8e构建本机android应用程序.

如果构建为Java + NDK应用程序,即使用加载.so文件的Java接口,初始化OpenGL并调用.so中的方法,代码编译正常并且运行没有问题.

但是,当编译为"本机活动"时,在setup()函数(下面的代码)之后,LogCat输出 A//system/bin/app_process(27426): stack corruption detected: aborted

void Canvas::Setup ( void ) 
{ 

    // initialize OpenGL ES 2

    // Here specify the attributes of the desired configuration.
    // Below, we select an EGLConfig with at least 8 bits per color
    // component compatible with on-screen windows     
    const EGLint attribs[] =
    {
        EGL_RENDERABLE_TYPE,    EGL_OPENGL_ES2_BIT,
        EGL_RED_SIZE,           8,
        EGL_GREEN_SIZE,         8,
        EGL_BLUE_SIZE,          8,
        EGL_NONE
    };
    // ..

    // surface, window and context related data
    EGLint      w, 
                h, …
Run Code Online (Sandbox Code Playgroud)

c++ opengl-es android-ndk

7
推荐指数
1
解决办法
4438
查看次数

标签 统计

android-ndk ×1

c++ ×1

opengl-es ×1