This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

OpenGL ES Emulator write fail when map GL_PIXEL_UNPACK_BUFFER in 3.2

I have a test code below:   

glGenBuffers(1, &buf);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buf);
check_error(__FILE__, __LINE__);
glBufferData(GL_PIXEL_UNPACK_BUFFER, render_width * render_height*4, yuvdata, GL_STREAM_DRAW);
check_error(__FILE__, __LINE__);
GLubyte* ptr = (GLubyte*)glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, render_width * render_height * 4, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT );
check_error(__FILE__, __LINE__);
if (ptr)
{
	// update data directly on the mapped buffer
	updatePixels(ptr, render_width * render_height * 4);
	glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);  // release pointer to mapping buffer
}

It works well by the emulator when I chose 3.0 and 3.1.

while I change to include the gl32.h, compile is ok, but will crash because the ptr cannot write and read after map.

I don't know why. no error when check, just crash when update pixel.