Alireza Peer
Alireza Peer

Reputation: 908

Opengl - glGenTextures Error 1280

Im implementing Render to texture Using FBOs in android, as first step im creating a texture, but i get error 1280 by calling GLES20.glGenTextures method.

the Texture Creator function is bellow:

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];
} 

when i call this method it returns error 1280.

Upvotes: 2

Views: 5826

Answers (1)

nkcode
nkcode

Reputation: 381

You got a GL_INVALID_ENUM error, which means you passed an unsupported enum value to a GL function. error is not in CreateTexture function , it is probably in function call before CreateTexture or in your opengl init function

Upvotes: 3

Related Questions