Opengl Create FBO- fatal signal 11 error

| | August 4, 2015

in my android game, i want to render My scene in the FBO and a texture attached to it, and use that texture later, But When i use glGenFramebuffers i get this error:

07-30 06:17:27.839: A/libc(1338): Fatal signal 11 (SIGSEGV), code 1, fault addr 0xd0 in tid 1353 (GLThread 157)

here is my codes if needed:

createTexture function:

public int CreateTexture(int w, int h){
        int[] textureId = new int[1];
        int i;      
        i = GLES20.glGetError();
        GLES20.glGenTextures(1, textureId,0);
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId[0]);
        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, w, h, 0, GLES20.GL_RGBA, GLES20.GL_FLOAT, null);
ijad kon vali ba hichi poresh nakon hanooz
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);

        if(i!=0){
            Log.d("ERROR", "ERROR Happend"+i+"");
            return i;
        }

        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
        return textureId[0];
    } 

and onDrawFrame:

public synchronized void onDrawFrame(GL10 gl) {
    if(first){
    int renderTexture;
    renderTexture = CreateTexture(128,128 );
    GLES20.glGenFramebuffers(1, FBO,0);
    GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, renderTexture, 0);
    first = false;
    }
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, FBO[0]);
    // Some 'global' settings.
    //gl.glEnableClientState(GLES20.GL_VERTEX_ATTRIB_ARRAY_ENABLED);
    gl.glEnableClientState(GLES10.GL_VERTEX_ARRAY);

    gl.glVertexPointer(3, GLES20.GL_FLOAT, 0, mBufVertices);
    // Enable color array.
    gl.glEnableClientState(GLES10.GL_COLOR_ARRAY);
    gl.glColorPointer(4, GLES20.GL_FLOAT, 0, mBufColors);
    //inja khasiate transparent ro faAl mikonim ke betoonim too CurlPage be kaaghaz alpha bedim
    gl.glEnable(GLES20.GL_BLEND);
    gl.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    gl.glDisable(GLES10.GL_LIGHTING);
    gl.glDisable(GLES20.GL_TEXTURE_2D);
    gl.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, mVerticesCountFront);
    int backStartIdx = Math.max(0, mVerticesCountFront - 2);
    //Log.d("mVerticesCountFront", ""+mVerticesCountFront+"");
    int backCount = mVerticesCountFront + mVerticesCountBack - backStartIdx;

    // Draw back facing blank vertices.
    //gl.glColor4f(1.0f, 0.0f, 0.0f, 0.5f);
    gl.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, backStartIdx, backCount);

    // Disable textures and color array.
    gl.glDisableClientState(GLES10.GL_TEXTURE_COORD_ARRAY);
    gl.glDisableClientState(GLES10.GL_COLOR_ARRAY);

    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
    gl.glDisableClientState(GLES10.GL_VERTEX_ARRAY);
}

any idea of Why i get such error?

Leave a Reply