Exemplo n.º 1
0
void TextureViewGL::ReadPixels(RenderContext_Base_GL* gl, TextureBase::ReadPixelUpdateParams& params) {
	if (params.lock.test_and_set(std::memory_order_release))
		return;
	PixelBox* pixels = params.box;
	gl->ActivateTexture(target, texture);
	Size dim = gl->GetTextureParams(target);

	pixels->data = static_cast<uint8*>(
		NEX_ALLOC(dim.dx * dim.dy * pixelFormat.pixelSize, MEMCAT_GENERAL));
	pixels->left = 0;
	pixels->right = dim.dx;
	pixels->top = 0;
	pixels->bottom = dim.dy;
	pixels->front = 0;
	pixels->back = 1;
	pixels->format = pixelFormat.textureFormat;
	pixels->deleteData = true;
	gl->GetTextureData(target, pixelFormat.internalFormat, pixelFormat.dataType, pixels->data);
	pixels->CalculatePitches();
}