2018-04-08 21:17:35 +02:00
|
|
|
using OpenTK;
|
|
|
|
using OpenTK.Graphics.OpenGL;
|
|
|
|
using System;
|
2018-04-13 20:12:58 +02:00
|
|
|
using System.Collections.Generic;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
public class OGLFrameBuffer : IGalFrameBuffer
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-04-14 05:39:24 +02:00
|
|
|
private struct Rect
|
|
|
|
{
|
|
|
|
public int X { get; private set; }
|
|
|
|
public int Y { get; private set; }
|
|
|
|
public int Width { get; private set; }
|
|
|
|
public int Height { get; private set; }
|
|
|
|
|
|
|
|
public Rect(int X, int Y, int Width, int Height)
|
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
this.X = X;
|
|
|
|
this.Y = Y;
|
|
|
|
this.Width = Width;
|
2018-04-14 05:39:24 +02:00
|
|
|
this.Height = Height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
private class FrameBuffer
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-04-13 20:12:58 +02:00
|
|
|
public int Width { get; set; }
|
|
|
|
public int Height { get; set; }
|
|
|
|
|
|
|
|
public int Handle { get; private set; }
|
|
|
|
public int RbHandle { get; private set; }
|
|
|
|
public int TexHandle { get; private set; }
|
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
public FrameBuffer(int Width, int Height, bool HasRenderBuffer)
|
2018-04-13 20:12:58 +02:00
|
|
|
{
|
|
|
|
this.Width = Width;
|
|
|
|
this.Height = Height;
|
|
|
|
|
|
|
|
Handle = GL.GenFramebuffer();
|
|
|
|
TexHandle = GL.GenTexture();
|
2018-07-23 16:21:05 +02:00
|
|
|
|
|
|
|
if (HasRenderBuffer)
|
|
|
|
{
|
|
|
|
RbHandle = GL.GenRenderbuffer();
|
|
|
|
}
|
2018-04-13 20:12:58 +02:00
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
private const int NativeWidth = 1280;
|
|
|
|
private const int NativeHeight = 720;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
private Dictionary<long, FrameBuffer> Fbs;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-14 05:39:24 +02:00
|
|
|
private Rect Viewport;
|
2018-04-14 06:31:27 +02:00
|
|
|
private Rect Window;
|
2018-04-14 05:39:24 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
private FrameBuffer CurrFb;
|
|
|
|
private FrameBuffer CurrReadFb;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
private FrameBuffer RawFb;
|
2018-04-13 20:12:58 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
private bool FlipX;
|
|
|
|
private bool FlipY;
|
2018-04-13 20:12:58 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
private int CropTop;
|
|
|
|
private int CropLeft;
|
|
|
|
private int CropRight;
|
|
|
|
private int CropBottom;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
public OGLFrameBuffer()
|
|
|
|
{
|
2018-04-13 20:12:58 +02:00
|
|
|
Fbs = new Dictionary<long, FrameBuffer>();
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
public void Create(long Key, int Width, int Height)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
if (Fbs.TryGetValue(Key, out FrameBuffer Fb))
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-04-13 20:12:58 +02:00
|
|
|
if (Fb.Width != Width ||
|
|
|
|
Fb.Height != Height)
|
|
|
|
{
|
|
|
|
SetupTexture(Fb.TexHandle, Width, Height);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
Fb.Width = Width;
|
|
|
|
Fb.Height = Height;
|
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
return;
|
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
Fb = new FrameBuffer(Width, Height, true);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
SetupTexture(Fb.TexHandle, Width, Height);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
GL.BindFramebuffer(FramebufferTarget.Framebuffer, Fb.Handle);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, Fb.RbHandle);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
GL.RenderbufferStorage(
|
|
|
|
RenderbufferTarget.Renderbuffer,
|
|
|
|
RenderbufferStorage.Depth24Stencil8,
|
|
|
|
Width,
|
|
|
|
Height);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
GL.FramebufferRenderbuffer(
|
|
|
|
FramebufferTarget.Framebuffer,
|
|
|
|
FramebufferAttachment.DepthStencilAttachment,
|
|
|
|
RenderbufferTarget.Renderbuffer,
|
|
|
|
Fb.RbHandle);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
GL.FramebufferTexture(
|
|
|
|
FramebufferTarget.Framebuffer,
|
|
|
|
FramebufferAttachment.ColorAttachment0,
|
|
|
|
Fb.TexHandle,
|
|
|
|
0);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
GL.DrawBuffer(DrawBufferMode.ColorAttachment0);
|
2018-04-13 20:12:58 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
Fbs.Add(Key, Fb);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
public void Bind(long Key)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
if (Fbs.TryGetValue(Key, out FrameBuffer Fb))
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-04-13 20:12:58 +02:00
|
|
|
GL.BindFramebuffer(FramebufferTarget.Framebuffer, Fb.Handle);
|
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
CurrFb = Fb;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
2018-04-13 20:12:58 +02:00
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
public void BindTexture(long Key, int Index)
|
2018-04-13 20:12:58 +02:00
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
if (Fbs.TryGetValue(Key, out FrameBuffer Fb))
|
2018-04-13 20:12:58 +02:00
|
|
|
{
|
|
|
|
GL.ActiveTexture(TextureUnit.Texture0 + Index);
|
|
|
|
|
|
|
|
GL.BindTexture(TextureTarget.Texture2D, Fb.TexHandle);
|
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
public void Set(long Key)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
if (Fbs.TryGetValue(Key, out FrameBuffer Fb))
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-07-23 16:21:05 +02:00
|
|
|
CurrReadFb = Fb;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
2018-04-13 20:12:58 +02:00
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
public void Set(byte[] Data, int Width, int Height)
|
|
|
|
{
|
2018-07-23 16:21:05 +02:00
|
|
|
if (RawFb == null)
|
2018-04-13 20:12:58 +02:00
|
|
|
{
|
2018-07-23 16:21:05 +02:00
|
|
|
CreateRawFb(Width, Height);
|
2018-04-13 20:12:58 +02:00
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
if (RawFb.Width != Width ||
|
|
|
|
RawFb.Height != Height)
|
2018-04-13 20:12:58 +02:00
|
|
|
{
|
2018-07-23 16:21:05 +02:00
|
|
|
SetupTexture(RawFb.TexHandle, Width, Height);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
RawFb.Width = Width;
|
|
|
|
RawFb.Height = Height;
|
2018-04-13 20:12:58 +02:00
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
GL.ActiveTexture(TextureUnit.Texture0);
|
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
GL.BindTexture(TextureTarget.Texture2D, RawFb.TexHandle);
|
2018-04-13 20:12:58 +02:00
|
|
|
|
|
|
|
(PixelFormat Format, PixelType Type) = OGLEnumConverter.GetTextureFormat(GalTextureFormat.A8B8G8R8);
|
|
|
|
|
|
|
|
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, Width, Height, Format, Type, Data);
|
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
CurrReadFb = RawFb;
|
2018-04-13 20:12:58 +02:00
|
|
|
}
|
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
public void SetTransform(bool FlipX, bool FlipY, int Top, int Left, int Right, int Bottom)
|
2018-04-13 20:12:58 +02:00
|
|
|
{
|
2018-07-23 16:21:05 +02:00
|
|
|
this.FlipX = FlipX;
|
|
|
|
this.FlipY = FlipY;
|
2018-06-24 02:39:25 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
CropTop = Top;
|
|
|
|
CropLeft = Left;
|
|
|
|
CropRight = Right;
|
|
|
|
CropBottom = Bottom;
|
2018-04-13 20:12:58 +02:00
|
|
|
}
|
|
|
|
|
2018-04-14 06:14:42 +02:00
|
|
|
public void SetWindowSize(int Width, int Height)
|
|
|
|
{
|
2018-04-14 06:31:27 +02:00
|
|
|
Window = new Rect(0, 0, Width, Height);
|
2018-04-14 06:14:42 +02:00
|
|
|
}
|
|
|
|
|
2018-04-14 05:39:24 +02:00
|
|
|
public void SetViewport(int X, int Y, int Width, int Height)
|
|
|
|
{
|
|
|
|
Viewport = new Rect(X, Y, Width, Height);
|
|
|
|
|
2018-07-19 07:30:21 +02:00
|
|
|
SetViewport(Viewport);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SetViewport(Rect Viewport)
|
|
|
|
{
|
|
|
|
GL.Viewport(
|
|
|
|
Viewport.X,
|
|
|
|
Viewport.Y,
|
|
|
|
Viewport.Width,
|
|
|
|
Viewport.Height);
|
2018-04-14 05:39:24 +02:00
|
|
|
}
|
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
public void Render()
|
|
|
|
{
|
2018-07-23 16:21:05 +02:00
|
|
|
if (CurrReadFb != null)
|
2018-04-13 20:12:58 +02:00
|
|
|
{
|
2018-07-23 16:21:05 +02:00
|
|
|
int SrcX0, SrcX1, SrcY0, SrcY1;
|
2018-07-07 04:40:12 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
if (CropLeft == 0 && CropRight == 0)
|
|
|
|
{
|
|
|
|
SrcX0 = 0;
|
|
|
|
SrcX1 = CurrReadFb.Width;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SrcX0 = CropLeft;
|
|
|
|
SrcX1 = CropRight;
|
|
|
|
}
|
2018-07-07 04:40:12 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
if (CropTop == 0 && CropBottom == 0)
|
|
|
|
{
|
|
|
|
SrcY0 = 0;
|
|
|
|
SrcY1 = CurrReadFb.Height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SrcY0 = CropTop;
|
|
|
|
SrcY1 = CropBottom;
|
|
|
|
}
|
2018-07-07 04:40:12 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
float RatioX = MathF.Min(1f, (Window.Height * (float)NativeWidth) / ((float)NativeHeight * Window.Width));
|
|
|
|
float RatioY = MathF.Min(1f, (Window.Width * (float)NativeHeight) / ((float)NativeWidth * Window.Height));
|
2018-04-14 03:42:55 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
int DstWidth = (int)(Window.Width * RatioX);
|
|
|
|
int DstHeight = (int)(Window.Height * RatioY);
|
2018-04-14 03:42:55 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
int DstPaddingX = (Window.Width - DstWidth) / 2;
|
|
|
|
int DstPaddingY = (Window.Height - DstHeight) / 2;
|
2018-04-13 20:12:58 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
int DstX0 = FlipX ? Window.Width - DstPaddingX : DstPaddingX;
|
|
|
|
int DstX1 = FlipX ? DstPaddingX : Window.Width - DstPaddingX;
|
2018-04-13 20:12:58 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
int DstY0 = FlipY ? DstPaddingY : Window.Height - DstPaddingY;
|
|
|
|
int DstY1 = FlipY ? Window.Height - DstPaddingY : DstPaddingY;
|
2018-04-13 20:12:58 +02:00
|
|
|
|
|
|
|
GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
|
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
GL.Viewport(0, 0, Window.Width, Window.Height);
|
2018-04-13 20:12:58 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, CurrReadFb.Handle);
|
2018-04-13 20:12:58 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
2018-04-13 20:12:58 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
GL.BlitFramebuffer(
|
|
|
|
SrcX0, SrcY0, SrcX1, SrcY1,
|
|
|
|
DstX0, DstY0, DstX1, DstY1,
|
|
|
|
ClearBufferMask.ColorBufferBit, BlitFramebufferFilter.Linear);
|
2018-04-13 20:12:58 +02:00
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2018-07-19 07:30:21 +02:00
|
|
|
public void Copy(
|
|
|
|
long SrcKey,
|
|
|
|
long DstKey,
|
|
|
|
int SrcX0,
|
|
|
|
int SrcY0,
|
|
|
|
int SrcX1,
|
|
|
|
int SrcY1,
|
|
|
|
int DstX0,
|
|
|
|
int DstY0,
|
|
|
|
int DstX1,
|
|
|
|
int DstY1)
|
|
|
|
{
|
|
|
|
if (Fbs.TryGetValue(SrcKey, out FrameBuffer SrcFb) &&
|
|
|
|
Fbs.TryGetValue(DstKey, out FrameBuffer DstFb))
|
|
|
|
{
|
|
|
|
GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, SrcFb.Handle);
|
|
|
|
GL.BindFramebuffer(FramebufferTarget.DrawFramebuffer, DstFb.Handle);
|
|
|
|
|
|
|
|
GL.Clear(ClearBufferMask.ColorBufferBit);
|
|
|
|
|
|
|
|
GL.BlitFramebuffer(
|
|
|
|
SrcX0, SrcY0, SrcX1, SrcY1,
|
|
|
|
DstX0, DstY0, DstX1, DstY1,
|
|
|
|
ClearBufferMask.ColorBufferBit,
|
|
|
|
BlitFramebufferFilter.Linear);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
public void GetBufferData(long Key, Action<byte[]> Callback)
|
2018-04-26 04:11:26 +02:00
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
if (Fbs.TryGetValue(Key, out FrameBuffer Fb))
|
2018-04-26 04:11:26 +02:00
|
|
|
{
|
|
|
|
GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, Fb.Handle);
|
|
|
|
|
|
|
|
byte[] Data = new byte[Fb.Width * Fb.Height * 4];
|
|
|
|
|
|
|
|
(PixelFormat Format, PixelType Type) = OGLEnumConverter.GetTextureFormat(GalTextureFormat.A8B8G8R8);
|
|
|
|
|
|
|
|
GL.ReadPixels(
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
Fb.Width,
|
|
|
|
Fb.Height,
|
|
|
|
Format,
|
|
|
|
Type,
|
|
|
|
Data);
|
|
|
|
|
|
|
|
Callback(Data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-19 07:30:21 +02:00
|
|
|
public void SetBufferData(
|
|
|
|
long Key,
|
|
|
|
int Width,
|
|
|
|
int Height,
|
|
|
|
GalTextureFormat Format,
|
|
|
|
byte[] Buffer)
|
2018-04-14 05:39:24 +02:00
|
|
|
{
|
2018-07-19 07:30:21 +02:00
|
|
|
if (Fbs.TryGetValue(Key, out FrameBuffer Fb))
|
|
|
|
{
|
|
|
|
GL.BindTexture(TextureTarget.Texture2D, Fb.TexHandle);
|
|
|
|
|
|
|
|
const int Level = 0;
|
|
|
|
const int Border = 0;
|
|
|
|
|
|
|
|
const PixelInternalFormat InternalFmt = PixelInternalFormat.Rgba;
|
|
|
|
|
|
|
|
(PixelFormat GlFormat, PixelType Type) = OGLEnumConverter.GetTextureFormat(Format);
|
|
|
|
|
|
|
|
GL.TexImage2D(
|
|
|
|
TextureTarget.Texture2D,
|
|
|
|
Level,
|
|
|
|
InternalFmt,
|
|
|
|
Width,
|
|
|
|
Height,
|
|
|
|
Border,
|
|
|
|
GlFormat,
|
|
|
|
Type,
|
|
|
|
Buffer);
|
|
|
|
}
|
2018-04-14 05:39:24 +02:00
|
|
|
}
|
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
private void CreateRawFb(int Width, int Height)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-07-23 16:21:05 +02:00
|
|
|
if (RawFb == null)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-07-23 16:21:05 +02:00
|
|
|
RawFb = new FrameBuffer(Width, Height, false);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
SetupTexture(RawFb.TexHandle, Width, Height);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
RawFb.Width = Width;
|
|
|
|
RawFb.Height = Height;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
GL.BindFramebuffer(FramebufferTarget.Framebuffer, RawFb.Handle);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
GL.FramebufferTexture(
|
|
|
|
FramebufferTarget.Framebuffer,
|
|
|
|
FramebufferAttachment.ColorAttachment0,
|
|
|
|
RawFb.TexHandle,
|
|
|
|
0);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-23 16:21:05 +02:00
|
|
|
GL.Viewport(0, 0, Width, Height);
|
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
2018-04-13 20:12:58 +02:00
|
|
|
|
|
|
|
private void SetupTexture(int Handle, int Width, int Height)
|
|
|
|
{
|
|
|
|
GL.BindTexture(TextureTarget.Texture2D, Handle);
|
|
|
|
|
2018-04-14 03:42:55 +02:00
|
|
|
const int MinFilter = (int)TextureMinFilter.Linear;
|
|
|
|
const int MagFilter = (int)TextureMagFilter.Linear;
|
2018-04-13 20:12:58 +02:00
|
|
|
|
2018-04-14 03:42:55 +02:00
|
|
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, MinFilter);
|
|
|
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, MagFilter);
|
2018-04-13 20:12:58 +02:00
|
|
|
|
|
|
|
(PixelFormat Format, PixelType Type) = OGLEnumConverter.GetTextureFormat(GalTextureFormat.A8B8G8R8);
|
|
|
|
|
|
|
|
const PixelInternalFormat InternalFmt = PixelInternalFormat.Rgba;
|
|
|
|
|
|
|
|
const int Level = 0;
|
|
|
|
const int Border = 0;
|
|
|
|
|
|
|
|
GL.TexImage2D(
|
|
|
|
TextureTarget.Texture2D,
|
|
|
|
Level,
|
|
|
|
InternalFmt,
|
|
|
|
Width,
|
|
|
|
Height,
|
|
|
|
Border,
|
|
|
|
Format,
|
|
|
|
Type,
|
|
|
|
IntPtr.Zero);
|
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
}
|