aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Gal/OpenGL/OpenGLRenderer.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-02-23 18:48:27 -0300
committergdkchan <gab.dark.100@gmail.com>2018-02-23 18:48:27 -0300
commit2ed733b1d5addad027f48acfdd407e64b71427fc (patch)
tree1254df3ab2bace8de561b5a3549f668fabcf4aa9 /Ryujinx.Graphics/Gal/OpenGL/OpenGLRenderer.cs
parenteafc58c9f2e2e0c19d22f0da2a93ab5372aeef29 (diff)
Somewhat better NvFlinger (I guess) (fixes #30)
Diffstat (limited to 'Ryujinx.Graphics/Gal/OpenGL/OpenGLRenderer.cs')
-rw-r--r--Ryujinx.Graphics/Gal/OpenGL/OpenGLRenderer.cs40
1 files changed, 37 insertions, 3 deletions
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OpenGLRenderer.cs b/Ryujinx.Graphics/Gal/OpenGL/OpenGLRenderer.cs
index 7429569b..6bf17d09 100644
--- a/Ryujinx.Graphics/Gal/OpenGL/OpenGLRenderer.cs
+++ b/Ryujinx.Graphics/Gal/OpenGL/OpenGLRenderer.cs
@@ -1,7 +1,9 @@
+using OpenTK;
using OpenTK.Graphics.OpenGL;
using System;
using System.Collections.Generic;
+
namespace Ryujinx.Graphics.Gal.OpenGL
{
public class OpenGLRenderer : IGalRenderer
@@ -25,6 +27,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
private Queue<Action> ActionsQueue;
+ private FrameBuffer FbRenderer;
+
public long FrameBufferPtr { get; set; }
public OpenGLRenderer()
@@ -36,6 +40,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL
ActionsQueue = new Queue<Action>();
}
+ public void InitializeFrameBuffer()
+ {
+ FbRenderer = new FrameBuffer(1280, 720);
+ }
+
public void QueueAction(Action ActionMthd)
{
ActionsQueue.Enqueue(ActionMthd);
@@ -43,14 +52,18 @@ namespace Ryujinx.Graphics.Gal.OpenGL
public void RunActions()
{
- while (ActionsQueue.Count > 0)
+ int Count = ActionsQueue.Count;
+
+ while (Count-- > 0)
{
ActionsQueue.Dequeue()();
}
- }
+ }
public void Render()
{
+ FbRenderer.Render();
+
for (int Index = 0; Index < VertexBuffers.Count; Index++)
{
VertexBuffer Vb = VertexBuffers[Index];
@@ -62,7 +75,28 @@ namespace Ryujinx.Graphics.Gal.OpenGL
GL.DrawArrays(PrimitiveType.TriangleStrip, 0, Vb.PrimCount);
}
}
-
+ }
+
+ public void SetWindowSize(int Width, int Height)
+ {
+ FbRenderer.WindowWidth = Width;
+ FbRenderer.WindowHeight = Height;
+ }
+
+ public unsafe void SetFrameBuffer(
+ byte* Fb,
+ int Width,
+ int Height,
+ float ScaleX,
+ float ScaleY,
+ float Rotate)
+ {
+ Matrix2 Transform;
+
+ Transform = Matrix2.CreateScale(ScaleX, ScaleY);
+ Transform *= Matrix2.CreateRotation(Rotate);
+
+ FbRenderer.Set(Fb, Width, Height, Transform);
}
public void SendVertexBuffer(int Index, byte[] Buffer, int Stride, GalVertexAttrib[] Attribs)