Esempio n. 1
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            PendingRenderThreadActions?.Invoke();
            PendingRenderThreadActions = null;

            base.OnRenderFrame(e);

            if (ViewportSizeChanged)
            {
                ViewportSizeChanged = false;

                RecalculateViewPort();
            }

            //All new image producers should have their OpenGL
            //data initialized
            //This should only be done ONCE per image producer, on creation.
            if (ImageProducerCreationQueue.TryDequeue(out var imageProducer))
            {
                //So, some producers may be created but not actually ready
                //for rendering purposes.
                //To avoid this issue we check if they are dirty.
                //If the queued image isn't dirty yet, then it's not ready to even be renderer.
                //We can requeue it and maybe handle it later.
                if (imageProducer.isDirty)
                {
                    AddToRenderCollection(imageProducer);
                }
                else
                {
                    ImageProducerCreationQueue.Enqueue(imageProducer);
                }
            }

            //If we're logged in, we should render the static in-game renderables.
            //These are the frames around the dynamic UI elements.
            //Even after going to th e login screen, they never cleanup.
            if (GameStateHookable.LoggedIn)
            {
                RenderRenderables(InGameStaticRenderables);
            }

            RenderRenderables(Renderables);

            SwapBuffers();

            //For debugging texture uploads.

            /*if(textureUploadCount != 0)
             *      Console.WriteLine($"Texture Uploads this Frame: {textureUploadCount}");*/
        }
Esempio n. 2
0
 public void OnImageProducerCreated(object sender, IOpenTKImageRenderable imageProducer)
 {
     ImageProducerCreationQueue.Enqueue(imageProducer);
 }