Quantcast
Channel: Questions in topic: "dll"
Viewing all articles
Browse latest Browse all 706

InvalidProgramException: Invalid IL code with Mono.Cairo on MacOS

$
0
0
Hi everyone, I have "solved" a previous [problem with a DllFoundException][1] on MacOS, but I now have a new problem. I want to use Mono.Cairo with Unity on MacOs (and Windows and Android). My application on Windows works fine, so I tried to build my solution for MacOS, it didn't work. So I import it on my Mac and change the Mono.Cairo.dll (specific for Mac) in the Plugins folder. I find this exception for each accessor I want to use: InvalidProgramException: Invalid IL code in Cairo.ImageSurface:get_Data (): IL_0000: ret (NB: In this case it is get_Data but it can be any accessors from my ImageSurface or my Context). Draw.Start () (at Assets/Scripts/Draw.cs:39) Here is my code which works for windows to assign a texture I draw to my GameObject: using UnityEngine; using System; using System.Collections; using Cairo; public class Draw : MonoBehaviour { // Use this for initialization void Start() { ImageSurface surface = new ImageSurface(Format.ARGB32, 120, 120); Context cr = new Context(surface); // Examples are in 1.0 x 1.0 coordinate space cr.Scale(120, 120); // Drawing code goes here cr.SetSourceColor(new Cairo.Color(0, 0, 0)); cr.MoveTo(0, 0); cr.LineTo(1, 1); cr.MoveTo(1, 0); cr.LineTo(0, 1); cr.LineWidth = 0.2; cr.Stroke(); cr.Rectangle(0, 0, 0.5, 0.5); cr.SetSourceRGBA(1, 0, 0, 0.80); cr.Fill(); cr.Rectangle(0, 0.5, 0.5, 0.5); cr.SetSourceRGBA(0, 1, 0, 0.60); cr.Fill(); cr.Rectangle(0.5, 0, 0.5, 0.5); cr.SetSourceRGBA(0, 0, 0, 0.40); cr.Fill(); // Create my texture and assign it Texture2D text = new Texture2D(120, 120, TextureFormat.BGRA32, false); text.LoadRawTextureData(surface.Data); text.Apply(); this.renderer.material.mainTexture = text; ((IDisposable)cr.GetTarget()).Dispose(); ((IDisposable)cr).Dispose(); } } It draws this image : ![alt text][2] If anyone of you has an idea or suggestion, feel free to post it! :-) Bye [1]: http://answers.unity3d.com/questions/1001195/dllnotfoundexception-libcairoso2-on-macos.html [2]: /storage/temp/49664-test.png

Viewing all articles
Browse latest Browse all 706

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>