ike
ike

Reputation: 127

GL10.GL_SRC_COLOR raises invalid enumerant on Android

I have a working Opengl ES 1.0 Android program that includes blend function code that looks like this:

public void draw(GL10 gl) {

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glEnable(GL10.GL_TEXTURE_2D);
    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
    ...

However, this blend function does not quite meet my needs and I would like to replace the first parameter of glBlendFunc, the GL_SRC_ALPHA, with GL_SRC_COLOR. Unfortunately, this results in a GLException of "invalid enum." This would normally indicate that the parameter I am giving it is not a valid parameter for that object, but according to the OpenGL ES docs, this parameter is one of the accepted values for this function. Any idea why it might be generating this error?

Upvotes: 0

Views: 142

Answers (1)

derhass
derhass

Reputation: 45352

but according to the OpenGL ES docs, this parameter is one of the accepted values for this function

No, it is not. From the GLES 1.1 spec:

The functions DST_COLOR, ONE_MINUS_DST_COLOR, and SRC_ALPHA_SATURATE are valid only for src, and the functions SRC_COLOR andONE_MINUS_SRC_COLOR are valid only for dst. All other functions are valid for either src or dst.

GLES 1.x is quite limited in this regard, but that is how things are.

Upvotes: 2

Related Questions