OpenGL ES 3.0 在这里。我正在尝试读回 TRANSFORM_FEEDBACK 缓冲区的内容,如下所示:
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);
输出是
E: begin, error=0
E: failed to map tf buffer, error=1280
即它看起来真的像glMapBufferRange() 生成错误1280,谷歌告诉我是GL_INVALID_ENUM。
问题:
根据https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glMapBufferRange.xhtml, glMapBufferRange 绝不应该产生这样的错误。只有 GL_INVALID_VALUE、GL_INVALID_OPERATION 和 GL_OUT_OF_MEMORY 吗?