glMapBufferRange generates a GL_INVALID_ENUM error?

OpenGL ES 3.0 here. I am trying to read back the contents of a TRANSFORM_FEEDBACK buffer like this:

 GLES30.glBindBufferBase(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, 0, tfo );
 GLES30.glBeginTransformFeedback( GLES30.GL_POINTS);
 GLES30.glEnable(GL_RASTERIZER_DISCARD);
 GLES30.glDrawArrays( GLES30.GL_POINTS, 0, mNumVertices );
 GLES30.glDisable(GL_RASTERIZER_DISCARD);
 GLES30.glEndTransformFeedback();
 
 int error1 = GLES30.glGetError();
 Log.e("mesh", "begin, error="+error1);
 
 ByteBuffer buffer = (ByteBuffer)GLES30.glMapBufferRange( GLES30.GL_TRANSFORM_FEEDBACK, 0, 4*mNumVertices, GLES30.GL_MAP_READ_BIT);
 
 if( buffer!=null )
    {
    // use it
    }
 else
    {
    int error2 = GLES30.glGetError();
    Log.e("mesh", "failed to map tf buffer, error="+error2);
    }
 
 GLES30.glBindBufferBase(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, 0, 0);

and the output is

E: begin, error=0
E: failed to map tf buffer, error=1280

i.e. it really looks like glMapBufferRange() generates error 1280, which Google tells me is GL_INVALID_ENUM.

Problem:

according to glMapBufferRange - OpenGL ES 3 Reference Pages, glMapBufferRange is never supposed to generate such error. Only GL_INVALID_VALUE, GL_INVALID_OPERATION and GL_OUT_OF_MEMORY ?

That looks like a specification bug. What is it supposed to do if the target is some nonsense value? FWIW, the (desktop) 4.6 specification adds the following:

As for why it’s failing: you’re using GL_TRANSFORM_FEEDBACK when it should be GL_TRANSFORM_FEEDBACK_BUFFER. The former is the only valid target argument to glBindTransformFeedback, which is why that enumerant exists (and hence why the compiler didn’t catch the typo).

Of course - duh!

Thanks a lot!

This is covered in the spec. From the OpenGL ES 3.0 Specification:

So if anything, the man page is just missing this copy/paste verbiage which applies to all GL API calls.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.