Reputation: 1491
Here is an example code:
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pboId[pboCounter]);
glBufferData(GL_PIXEL_UNPACK_BUFFER, dataSize, 0, GL_STREAM_DRAW);
GLubyte* p = (GLubyte*)glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
I have noticed that task manager(windows 10) shows increased memory usage after glMapBuffer call. I have read that glMapBuffer may use malloc or "memory mapping" ? It it an evidence that malloc has been used ? Does glMapBuffer may also use a memory mapping for the above scenario (GL_WRTIE_ONLY) ?
Upvotes: 0
Views: 292
Reputation: 162174
The specific details on how glMapBuffer works are left open to the OpenGL implementation being used. It may, or may not use an additional shadow allocation.
However you must be careful about interpreting the number reported by Windows' "Task Manager": The number it reports in plain sight is the amount of address space allocated, not the actual amount of memory being used; the later can be much, much smaller.
Does glMapBuffer may also use a memory mapping for the above scenario (GL_WRTIE_ONLY)?
Yes of course.
Upvotes: 3