rem: glPixelStorei(GL_PACK_ROW_LENGTH, bitmap->width);
add: glPixelStorei(GL_UNPACK_ROW_LENGTH, bitmap->width);
context: bool glgfx_bitmap_unlock(struct glgfx_bitmap* bitmap, 			 int x, int y, int width, int height) {  struct glgfx_context* context = glgfx_context_getcurrent();  bool rc = false;  if (bitmap == NULL || !bitmap->locked) {    return false;  }  pthread_mutex_lock(&glgfx_mutex);  if (bitmap->locked_memory != NULL) {    if (context->have_GL_ARB_pixel_buffer_object) {      glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, bitmap->pbo);      if (glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB)) {	rc = true;      }      if (width != 0 && height != 0 &&	  (bitmap->locked_access == GL_READ_WRITE_ARB ||	   bitmap->locked_access == GL_WRITE_ONLY_ARB)) {	glBindTexture(GL_TEXTURE_RECTANGLE_ARB, bitmap->texture);	GLGFX_CHECKERROR();	glPixelStorei(GL_PACK_ROW_LENGTH, bitmap->width);	glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0,			0, 0, width, height,			formats[bitmap->format].format,			formats[bitmap->format].type,			(void*) (x + y * bitmap->pbo_bytes_per_row));	GLGFX_CHECKERROR();	glPixelStorei(GL_PACK_ROW_LENGTH, 0);      }      glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);      GLGFX_CHECKERROR();    }    else {      if (width != 0 && height != 0 &&	  (bitmap->locked_access == GL_READ_WRITE_ARB ||	   bitmap->locked_access == GL_WRITE_ONLY_ARB)) {	glBindTexture(GL_TEXTURE_RECTANGLE_ARB, bitmap->texture);	GLGFX_CHECKERROR();		glPixelStorei(GL_PACK_ROW_LENGTH, bitmap->width);	glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0,			0, 0, width, height,			formats[bitmap->format].format,			formats[bitmap->format].type,			(void*) (bitmap->buffer + x + y * bitmap->pbo_bytes_per_row));	GLGFX_CHECKERROR();	glPixelStorei(GL_PACK_ROW_LENGTH, 0);      }    }    bitmap->locked_memory = NULL;  }  bitmap->locked = false;    pthread_mutex_unlock(&glgfx_mutex);  return rc;}