GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* handle, int* width, int* height, int* format, void** buffer) { void* mesaBuffer; GLint mesaWidth, mesaHeight, mesaFormat; _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); if (!OSMesaGetColorBuffer(window->context.osmesa.handle, &mesaWidth, &mesaHeight, &mesaFormat, &mesaBuffer)) { _glfwInputError(GLFW_PLATFORM_ERROR, "OSMesa: Failed to retrieve color buffer"); return GLFW_FALSE; } if (width) *width = mesaWidth; if (height) *height = mesaHeight; if (format) *format = mesaFormat; if (buffer) *buffer = mesaBuffer; return GLFW_TRUE; }
SkMesaGLContext::AutoContextRestore::AutoContextRestore() { fOldContext = (Context)OSMesaGetCurrentContext(); if (NULL != (OSMesaContext)fOldContext) { OSMesaGetColorBuffer((OSMesaContext)fOldContext, &fOldWidth, &fOldHeight, &fOldFormat, &fOldImage); } }
void Renderer3dImpl::get_buffers(int width, int height, void* rgb, void* depth) const { GLint tmp_width; GLint tmp_height; GLint tmp_format; void* tmp; if (rgb) { OSMesaGetColorBuffer( ctx_, &tmp_width, &tmp_height, &tmp_format, &tmp ); std::memcpy(rgb, tmp, tmp_width*tmp_height*tmp_format); } if (depth) { OSMesaGetDepthBuffer( ctx_, &tmp_width, &tmp_height, &tmp_format, &tmp ); std::memcpy(depth, tmp, tmp_width*tmp_height*tmp_format); } }