예제 #1
0
 public static void LogThreadInfo(Thread th, string message)
 {
     if (message == th.Name)
     {
         message = "";
     }
     Log.Info("Thread #{ThreadId} {ThreadName} {Message}", th.ManagedThreadId, th.Name, message);
 }
예제 #2
0
 public static void DumpInfo(bool listItems)
 {
     Log.Info("Allocated Textures: {TextureCount}", ReferencedCount());
     if (listItems)
     {
         lock (References)
         {
             foreach (var reference in References.Values)
             {
                 RendererTexture texture;
                 if (reference.TryGetTarget(out texture))
                 {
                     Log.Info("Texture #{Handle} {Name}", texture.Handle, texture.ObjectLabel);
                 }
             }
         }
     }
 }
예제 #3
0
        private void OnRenderFrameInternal(FrameEventArgs e)
        {
            if (!RenderInitialized)
            {
                Log.Verbose("Init OpenGL Bindings");
                Log.Verbose("Grab Context");
                Window.MakeCurrent();

                Log.Verbose("Load OpenGL Bindings");
                GL.LoadBindings(new GLFWBindingsContext());
                var vendor  = GL.GetString(StringName.Vendor);
                var version = GL.GetString(StringName.Version);
                var shadingLanguageVersion = GL.GetString(StringName.ShadingLanguageVersion);
                var renderer = GL.GetString(StringName.Renderer);

                Log.Info($"Vendor: {vendor}, version: {version}, shadinglangVersion: {shadingLanguageVersion}, renderer: {renderer}");

                EnableDebugCallback();

                RenderInitialized = true;
            }

            if (!RenderThreadHasContext)
            {
                Window.MakeCurrent();
                RenderThreadHasContext = true;
            }

            SetRenderThread();
            RenderReady = true;

            if (Enabled)
            {
                RenderFrame?.Invoke(e);
            }
        }
예제 #4
0
        public static Texture CreateFromFile(string sourcePath)
        {
            Log.Info("Loading: {SourcePath}", sourcePath);
            var   imagePath = AssetManager.GetAssetsPath(sourcePath);
            Image bitmap    = Image.Load(imagePath);

            var txt = new Texture(bitmap.Width, bitmap.Height)
            {
                SourcePath        = sourcePath,
                Label             = Path.GetFileName(sourcePath),
                AutoDisposeBitmap = true,
            };

            txt.SetData(bitmap);
            return(txt);
        }