private bool CreateMesaContext()
{
try {
_ctx = GraphicsContext.CreateMesaContext();
long ctxPtr = long.Parse(_ctx.ToString()); // cannot access private .Context
if (ctxPtr != 0) {
_ctx.MakeCurrent(new BitmapWindowInfo(_surface.BitmapData));
if (!_ctx.IsCurrent) {
Logger.Warn("Could not make context current");
throw new InvalidOperationException("Mesa context could not be made current");
}
}
Logger.Info("Successfully acquired Mesa context");
return true;
}
catch {
Logger.Warn("Mesa context could not be created");
return false;
}
}