Update to the latest OpenTK and BlurgText.
This commit is contained in:
@@ -74,9 +74,9 @@ namespace Dashboard.BlurgText.OpenGL
|
|||||||
|
|
||||||
private void UpdateTexture(IntPtr texture, IntPtr buffer, int x, int y, int width, int height)
|
private void UpdateTexture(IntPtr texture, IntPtr buffer, int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
GL.BindTexture(TextureTarget.Texture2d, (int)texture);
|
GL.BindTexture(TextureTarget.Texture2D, (int)texture);
|
||||||
GL.TexSubImage2D(TextureTarget.Texture2d, 0, x, y, width, height, OPENGL.PixelFormat.Rgba, PixelType.UnsignedByte, buffer);
|
GL.TexSubImage2D(TextureTarget.Texture2D, 0, x, y, width, height, OPENGL.PixelFormat.Rgba, PixelType.UnsignedByte, buffer);
|
||||||
// GL.TexSubImage2D(TextureTarget.Texture2d, 0, x, y, width, height, OPENGL.PixelFormat.Red, PixelType.Byte, buffer);
|
// GL.TexSubImage2D(TextureTarget.Texture2D, 0, x, y, width, height, OPENGL.PixelFormat.Red, PixelType.Byte, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -84,16 +84,16 @@ namespace Dashboard.BlurgText.OpenGL
|
|||||||
{
|
{
|
||||||
int texture = GL.GenTexture();
|
int texture = GL.GenTexture();
|
||||||
|
|
||||||
GL.BindTexture(TextureTarget.Texture2d, texture);
|
GL.BindTexture(TextureTarget.Texture2D, texture);
|
||||||
GL.TexImage2D(TextureTarget.Texture2d, 0, InternalFormat.Rgba, width, height, 0, OPENGL.PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero);
|
GL.TexImage2D(TextureTarget.Texture2D, 0, InternalFormat.Rgba, width, height, 0, OPENGL.PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero);
|
||||||
// GL.TexImage2D(TextureTarget.Texture2d, 0, InternalFormat.R8, width, height, 0, OPENGL.PixelFormat.Red, PixelType.Byte, IntPtr.Zero);
|
// GL.TexImage2D(TextureTarget.Texture2D, 0, InternalFormat.R8, width, height, 0, OPENGL.PixelFormat.Red, PixelType.Byte, IntPtr.Zero);
|
||||||
|
|
||||||
GL.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
|
GL.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
|
||||||
GL.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
|
GL.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
|
||||||
// GL.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureSwizzleR, (int)TextureSwizzle.One);
|
// GL.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureSwizzleR, (int)TextureSwizzle.One);
|
||||||
// GL.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureSwizzleG, (int)TextureSwizzle.One);
|
// GL.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureSwizzleG, (int)TextureSwizzle.One);
|
||||||
// GL.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureSwizzleB, (int)TextureSwizzle.One);
|
// GL.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureSwizzleB, (int)TextureSwizzle.One);
|
||||||
// GL.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureSwizzleA, (int)TextureSwizzle.Red);
|
// GL.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureSwizzleA, (int)TextureSwizzle.Red);
|
||||||
|
|
||||||
_textures.Add(texture);
|
_textures.Add(texture);
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ namespace Dashboard.BlurgText.OpenGL
|
|||||||
|
|
||||||
foreach (DrawCall call in drawCalls)
|
foreach (DrawCall call in drawCalls)
|
||||||
{
|
{
|
||||||
GL.BindTexture(TextureTarget.Texture2d, call.Texture);
|
GL.BindTexture(TextureTarget.Texture2D, call.Texture);
|
||||||
GL.Uniform4f(_fillColorLocation, call.FillColor.X, call.FillColor.Y, call.FillColor.Z,
|
GL.Uniform4f(_fillColorLocation, call.FillColor.X, call.FillColor.Y, call.FillColor.Z,
|
||||||
call.FillColor.W);
|
call.FillColor.W);
|
||||||
GL.DrawElements(PrimitiveType.Triangles, call.Count, DrawElementsType.UnsignedShort, call.Offset);
|
GL.DrawElements(PrimitiveType.Triangles, call.Count, DrawElementsType.UnsignedShort, call.Offset);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BlurgText" Version="0.1.0-nightly-19" />
|
<PackageReference Include="BlurgText" Version="0.1.0-nightly-33" />
|
||||||
<ProjectReference Include="..\Dashboard.Common\Dashboard.Common.csproj" />
|
<ProjectReference Include="..\Dashboard.Common\Dashboard.Common.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<RootNamespace>Dashboard</RootNamespace>
|
<RootNamespace>Dashboard</RootNamespace>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
|||||||
@@ -67,14 +67,14 @@ namespace Dashboard.OpenGL.Drawing
|
|||||||
_program_image = GL.GetUniformLocation(_program, "image");
|
_program_image = GL.GetUniformLocation(_program, "image");
|
||||||
|
|
||||||
GL.GenTexture(out _white);
|
GL.GenTexture(out _white);
|
||||||
GL.BindTexture(TextureTarget.Texture2d, _white);
|
GL.BindTexture(TextureTarget.Texture2D, _white);
|
||||||
GL.TexImage2D(TextureTarget.Texture2d, 0, InternalFormat.Rgb, 1, 1, 0, OpenTK.Graphics.OpenGL.PixelFormat.Rgb, PixelType.Byte, IntPtr.Zero);
|
GL.TexImage2D(TextureTarget.Texture2D, 0, InternalFormat.Rgb, 1, 1, 0, OpenTK.Graphics.OpenGL.PixelFormat.Rgb, PixelType.Byte, IntPtr.Zero);
|
||||||
GL.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureSwizzleA, (int)All.One);
|
GL.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureSwizzleA, (int)All.One);
|
||||||
GL.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureSwizzleR, (int)All.One);
|
GL.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureSwizzleR, (int)All.One);
|
||||||
GL.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureSwizzleG, (int)All.One);
|
GL.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureSwizzleG, (int)All.One);
|
||||||
GL.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureSwizzleB, (int)All.One);
|
GL.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureSwizzleB, (int)All.One);
|
||||||
GL.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
|
GL.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
|
||||||
GL.TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
|
GL.TexParameteri(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
|
||||||
|
|
||||||
GL.GenVertexArray(out _vao);
|
GL.GenVertexArray(out _vao);
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ namespace Dashboard.OpenGL.Drawing
|
|||||||
GL.UseProgram(_program);
|
GL.UseProgram(_program);
|
||||||
|
|
||||||
GL.ActiveTexture(TextureUnit.Texture0);
|
GL.ActiveTexture(TextureUnit.Texture0);
|
||||||
GL.BindTexture(TextureTarget.Texture2d, _white);
|
GL.BindTexture(TextureTarget.Texture2D, _white);
|
||||||
|
|
||||||
GL.UniformMatrix4f(_program_transforms, 1, true, ref view);
|
GL.UniformMatrix4f(_program_transforms, 1, true, ref view);
|
||||||
GL.Uniform1i(_program_image, 0);
|
GL.Uniform1i(_program_image, 0);
|
||||||
@@ -155,7 +155,7 @@ namespace Dashboard.OpenGL.Drawing
|
|||||||
GL.UseProgram(_program);
|
GL.UseProgram(_program);
|
||||||
|
|
||||||
GL.ActiveTexture(TextureUnit.Texture0);
|
GL.ActiveTexture(TextureUnit.Texture0);
|
||||||
GL.BindTexture(TextureTarget.Texture2d, _white);
|
GL.BindTexture(TextureTarget.Texture2D, _white);
|
||||||
|
|
||||||
GL.UniformMatrix4f(_program_transforms, 1, true, ref view);
|
GL.UniformMatrix4f(_program_transforms, 1, true, ref view);
|
||||||
GL.Uniform1i(_program_image, 0);
|
GL.Uniform1i(_program_image, 0);
|
||||||
@@ -207,7 +207,7 @@ namespace Dashboard.OpenGL.Drawing
|
|||||||
GL.UseProgram(_program);
|
GL.UseProgram(_program);
|
||||||
|
|
||||||
GL.ActiveTexture(TextureUnit.Texture0);
|
GL.ActiveTexture(TextureUnit.Texture0);
|
||||||
GL.BindTexture(TextureTarget.Texture2d, ((GLTexture)texture).Handle);
|
GL.BindTexture(TextureTarget.Texture2D, ((GLTexture)texture).Handle);
|
||||||
|
|
||||||
GL.UniformMatrix4f(_program_transforms, 1, true, ref view);
|
GL.UniformMatrix4f(_program_transforms, 1, true, ref view);
|
||||||
GL.Uniform1i(_program_image, 0);
|
GL.Uniform1i(_program_image, 0);
|
||||||
|
|||||||
@@ -79,10 +79,10 @@ namespace Dashboard.OpenGL
|
|||||||
|
|
||||||
private TextureTarget Target { get; } = type switch
|
private TextureTarget Target { get; } = type switch
|
||||||
{
|
{
|
||||||
TextureType.Texture1D => TextureTarget.Texture1d,
|
TextureType.Texture1D => TextureTarget.Texture1D,
|
||||||
TextureType.Texture2D => TextureTarget.Texture2d,
|
TextureType.Texture2D => TextureTarget.Texture2D,
|
||||||
TextureType.Texture3D => TextureTarget.Texture3d,
|
TextureType.Texture3D => TextureTarget.Texture3D,
|
||||||
TextureType.Texture2DArray => TextureTarget.Texture2dArray,
|
TextureType.Texture2DArray => TextureTarget.Texture2DArray,
|
||||||
TextureType.Texture2DCube => TextureTarget.TextureCubeMap,
|
TextureType.Texture2DCube => TextureTarget.TextureCubeMap,
|
||||||
_ => throw new NotSupportedException()
|
_ => throw new NotSupportedException()
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Dashboard.OpenTK.PAL2
|
|||||||
TK.Window.PostUserEvent(new ApplicationQuitEventArgs());
|
TK.Window.PostUserEvent(new ApplicationQuitEventArgs());
|
||||||
});
|
});
|
||||||
|
|
||||||
EventQueue.EventRaised += OnEventRaised;
|
Toolkit.Event.EventRaised += OnEventRaised;
|
||||||
|
|
||||||
Toolkit.Init(options ?? new ToolkitOptions());
|
Toolkit.Init(options ?? new ToolkitOptions());
|
||||||
}
|
}
|
||||||
@@ -93,11 +93,11 @@ namespace Dashboard.OpenTK.PAL2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEventRaised(PalHandle? handle, PlatformEventType type, EventArgs args)
|
private void OnEventRaised(EventArgs args)
|
||||||
{
|
{
|
||||||
if (handle is WindowHandle window)
|
if (args is WindowEventArgs window)
|
||||||
{
|
{
|
||||||
OnWindowEventRaised(window, type, args);
|
OnWindowEventRaised(window.Window, window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -106,7 +106,7 @@ namespace Dashboard.OpenTK.PAL2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnWindowEventRaised(WindowHandle handle, PlatformEventType type, EventArgs args)
|
private void OnWindowEventRaised(WindowHandle handle, EventArgs args)
|
||||||
{
|
{
|
||||||
if (!_windowHandleWindowMap.TryGetValue(handle, out WindowExtraInfo? info))
|
if (!_windowHandleWindowMap.TryGetValue(handle, out WindowExtraInfo? info))
|
||||||
{
|
{
|
||||||
@@ -114,7 +114,8 @@ namespace Dashboard.OpenTK.PAL2
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type)
|
// TODO: fix this.
|
||||||
|
switch (PlatformEventType.UserMessage)
|
||||||
{
|
{
|
||||||
case PlatformEventType.UserMessage:
|
case PlatformEventType.UserMessage:
|
||||||
if (args is ApplicationQuitEventArgs)
|
if (args is ApplicationQuitEventArgs)
|
||||||
@@ -228,7 +229,7 @@ namespace Dashboard.OpenTK.PAL2
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Debugger?.LogDebug($"Unknown event type {type} with \"{args}\".");
|
Debugger?.LogDebug($"Unknown event type {args.GetType().Name} with \"{args}\".");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user