Opengl - glGenTextures错误1280

时间:2015-07-29 11:18:40

标签: android opengl-es

我实现渲染到纹理在android中使用FBO,作为创建纹理的第一步,但我通过调用GLES20.glGenTextures方法得到错误1280。

纹理创建器功能如下:

public int CreateTexture(int w, int h){
    final int[] textureId = new int[1];
    int i;
    //ijad mikonim 1 Adad texturte ro rooye textureID               
    GLES20.glGenTextures(1, textureId,0);
    i = GLES20.glGetError();
    //BindTexture miad texturo ro baraaye call shodan amaade mikone
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId[0]);
    //texture nahaE ro ijaad mikonim
    GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, w, h, 0, GLES20.GL_RGBA, GLES20.GL_FLOAT, null);
    //in null tooye voroodie akharie bala, mige ke fazaa ro baraye texture 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];
} 

当我调用此方法时,它返回错误1280。

1 个答案:

答案 0 :(得分:2)

您收到GL_INVALID_ENUM错误,这意味着您将不受支持的枚举值传递给GL函数。错误不在CreateTexture函数中,它可能在CreateTexture之前的函数调用中或在你的opengl init函数中

相关问题