c# - Is there any open source wrapper around UnityEngine.GL namespace that would provide System.Drawing.Graphics alike intereface? -
i love see system.drawing.graphics
methods drawpath(pen, path)
, translatetransform(dx, dy, order)
, scaletransform(sx, sy, order)
wrapped around unityengine.gl
(or @ least other opengl library create own port). there such wrapper/library?
assuming want draw on texture use in unity, here simpliest example using cairo build bitmap directely usable texturing opengl. wrapper mono.cairo
using system; using cairo; namespace cairotests { class program { static void main(string[] args) { int height = 512; int width = 512; int stride = 4 * width; int bmpsize = stride * height; byte[] bmp = new byte[bmpsize]; using (imagesurface surf = new imagesurface(bmp, format.argb32, width, height, stride)) { using (context ctx = new context(surf)) { ctx.setsourcergb(1, 0, 0); ctx.rectangle(10, 10, 100, 100); ctx.fill(); } surf.flush(); //surf.writetopng(@"c:/test.png"); } //now have bmp filled, , may pass game engine texture } } }
next step create egl context , try keep work on gpu, passing final texture bind existing one.
Comments
Post a Comment