daily update on 20240226 by nitload youmu
This commit is contained in:
@@ -15,6 +15,10 @@ namespace StgSharp
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern void InternalInitGL(int majorVersion, int minorVersion);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "loadGlfuncDefault",
|
||||
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
internal static extern IntPtr InternalLoadGlfuncDefault(string name);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "linkShaderProgram",
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe uint InternalLinkShaderProgram(GLcontext* context, uint shaderProgram);
|
||||
@@ -35,9 +39,8 @@ namespace StgSharp
|
||||
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
internal static extern unsafe void InternalUnloadImage(Image.ImageInfo* output);
|
||||
|
||||
#endregion
|
||||
#endregion ssgc api define
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
@@ -48,8 +51,6 @@ namespace StgSharp.Graphics
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct GLcontext
|
||||
{
|
||||
internal IntPtr usrPtr;
|
||||
|
||||
#region glapi
|
||||
|
||||
internal unsafe delegate*<uint, GLfixed, void> glAccumxOES;
|
||||
@@ -2585,12 +2586,6 @@ namespace StgSharp.Graphics
|
||||
internal unsafe delegate*<uint, uint, int*, void> glWindowRectanglesEXT;
|
||||
internal unsafe delegate*<uint, uint, uint, uint, uint, uint, void> glWriteMaskEXT;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
internal IntPtr glad_loader_handler;
|
||||
#endregion glapi
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Graphics;
|
||||
using System.Threading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Foundation;
|
||||
|
||||
#if Windows
|
||||
|
||||
#endif
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
@@ -19,21 +22,6 @@ namespace StgSharp
|
||||
InfoWarning,
|
||||
}
|
||||
|
||||
internal class LibHandle : SafeHandle
|
||||
{
|
||||
|
||||
public LibHandle(IntPtr invalidHandleValue, bool ownsHandle) : base(invalidHandleValue, ownsHandle)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool IsInvalid => throw new NotImplementedException();
|
||||
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
return PInvoke.FreeLibrary(new HMODULE(handle));
|
||||
}
|
||||
}
|
||||
|
||||
internal static unsafe partial class InternalIO
|
||||
{
|
||||
internal static Dictionary<TypeCode, uint> GLtype =
|
||||
@@ -47,6 +35,9 @@ namespace StgSharp
|
||||
internal const string SSC_libname =
|
||||
"StgSharpC";
|
||||
|
||||
internal static readonly GCHandle ssc_logHandle =
|
||||
GCHandle.Alloc(new byte[512], GCHandleType.Pinned);
|
||||
|
||||
static InternalIO()
|
||||
{
|
||||
GLtype.Add(TypeCode.Single, GLconst.FLOAT);
|
||||
@@ -58,18 +49,18 @@ namespace StgSharp
|
||||
GLtype.Add(TypeCode.Byte, GLconst.UNSIGNED_BYTE);
|
||||
}
|
||||
|
||||
internal static T InternalLoadProc<T>(LibHandle lib, string name) where T : Delegate
|
||||
[Obsolete("Not completed", true)]
|
||||
internal static IntPtr InternalLoadProc<T>(IntPtr lib, string name) where T : Delegate
|
||||
{
|
||||
try
|
||||
{
|
||||
IntPtr procPtr =
|
||||
#if Windows
|
||||
PInvoke.GetProcAddress(lib, name);
|
||||
IntPtr.Zero;
|
||||
#elif Linux
|
||||
|
||||
#endif
|
||||
T ret = Marshal.GetDelegateForFunctionPointer<T>(procPtr);
|
||||
return ret;
|
||||
return procPtr;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -91,9 +82,11 @@ namespace StgSharp
|
||||
}
|
||||
}
|
||||
|
||||
internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1);
|
||||
|
||||
internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType)
|
||||
{
|
||||
logSyncSemaphore.Wait();
|
||||
if (!File.Exists(InternalIO.SS_errorlog))
|
||||
{
|
||||
FileStream stream = File.Create(InternalIO.SS_errorlog);
|
||||
@@ -106,6 +99,7 @@ namespace StgSharp
|
||||
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
||||
logStream.WriteLine(logLine);
|
||||
}
|
||||
logSyncSemaphore.Release(1);
|
||||
}
|
||||
|
||||
internal static void InternalWriteLog(string logLine, LogType logType)
|
||||
@@ -123,4 +117,4 @@ namespace StgSharp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
using StgSharp.Envitronment;
|
||||
using StgSharp.Envitronment.Win32;
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Math;
|
||||
// using StgSharp.Envitronment;
|
||||
// using StgSharp.Envitronment.Win32;
|
||||
// using StgSharp.Graphics;
|
||||
// using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -11,16 +12,18 @@ using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Win32.UI.WindowsAndMessaging;
|
||||
|
||||
|
||||
#if Windows
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Foundation;
|
||||
using Windows.Win32.Graphics.OpenGL;
|
||||
using Windows.Win32.Graphics.Gdi;
|
||||
using Windows.Win32.UI;
|
||||
|
||||
// using Windows.Win32.UI.WindowsAndMessaging;
|
||||
// using Windows.Win32;
|
||||
// using Windows.Win32.Foundation;
|
||||
// using Windows.Win32.Graphics.OpenGL;
|
||||
// using Windows.Win32.Graphics.Gdi;
|
||||
// using Windows.Win32.UI;
|
||||
|
||||
#endif
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
internal enum GraphicAPI : byte
|
||||
@@ -32,7 +35,6 @@ namespace StgSharp
|
||||
|
||||
public static partial class Platform
|
||||
{
|
||||
|
||||
internal static GraphicAPI API = default;
|
||||
|
||||
private static uint markCount = 0;
|
||||
@@ -55,7 +57,7 @@ namespace StgSharp
|
||||
|
||||
/// <summary>
|
||||
/// Init an instance of OpenGL program,
|
||||
/// This method should be called before other
|
||||
/// This method should be called before other
|
||||
/// graphic methods, after LoadGL method.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -89,7 +91,6 @@ namespace StgSharp
|
||||
try
|
||||
{
|
||||
return Marshal.GetDelegateForFunctionPointer<TDele>(funcPtr);
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -99,7 +100,6 @@ namespace StgSharp
|
||||
|
||||
internal static Delegate ConvertAPI(IntPtr funcPtr, Type T)
|
||||
{
|
||||
|
||||
if (funcPtr == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("Failed to convert api, the function pointer is zero.");
|
||||
@@ -107,7 +107,6 @@ namespace StgSharp
|
||||
try
|
||||
{
|
||||
return Marshal.GetDelegateForFunctionPointer(funcPtr, T);
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -118,13 +117,14 @@ namespace StgSharp
|
||||
public static void Track(
|
||||
object target,
|
||||
string message,
|
||||
bool isConsole,
|
||||
[CallerFilePath] string filePath = "",
|
||||
[CallerMemberName] string callerName = "",
|
||||
[CallerLineNumber] int lineNumber = 0
|
||||
)
|
||||
{
|
||||
string log = $"Tracked object: {nameof(target)}\n";
|
||||
Type t = target.GetType();
|
||||
string log = $"Tracked object: {nameof(target)}\t\tType:{t.Name}\n";
|
||||
FieldInfo[] fieldInfo = t.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
log += "|\tFieldName\t|\tFieldType\t|\tFieldValue\t|\n";
|
||||
foreach (FieldInfo field in fieldInfo)
|
||||
@@ -133,8 +133,14 @@ namespace StgSharp
|
||||
}
|
||||
log += $"Tracking at:\n{filePath}\t{callerName}\tline {lineNumber}\n";
|
||||
log += $"Additional information:\n{message}\n";
|
||||
InternalIO.InternalWriteLog(log, LogType.Info);
|
||||
if (isConsole)
|
||||
{
|
||||
Console.WriteLine(log);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog(log, LogType.Info);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,199 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Windows.Win32.Foundation;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Reflection;
|
||||
using StgSharpDebug.Environment;
|
||||
using StgSharp.Math;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if Windows
|
||||
#pragma warning disable CA1416 // 验证平台兼容性
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using StgSharp.Envitronment.Win32;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Graphics.OpenGL;
|
||||
using Windows.Win32.Graphics.Gdi;
|
||||
using Windows.Win32.UI.WindowsAndMessaging;
|
||||
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public unsafe static partial class Platform
|
||||
{
|
||||
|
||||
internal static unsafe void CreatDummyContext()
|
||||
{
|
||||
string winclass_name = "Dummy_WGL_context";
|
||||
WNDCLASSW window_class = new WNDCLASSW()
|
||||
{
|
||||
style = WNDCLASS_STYLES.CS_HREDRAW | WNDCLASS_STYLES.CS_VREDRAW | WNDCLASS_STYLES.CS_OWNDC,
|
||||
lpfnWndProc = PInvoke.DefWindowProc,
|
||||
hInstance = new HINSTANCE(PInvoke.GetModuleHandle("").DangerousGetHandle()),
|
||||
lpszClassName = new PCWSTR((char*)Marshal.StringToHGlobalUni(winclass_name))
|
||||
};
|
||||
|
||||
if (PInvoke.RegisterClass(window_class) != 0)
|
||||
{
|
||||
throw new Exception("Failed in registing OpenGL window.");
|
||||
}
|
||||
|
||||
HWND h = PInvoke.CreateWindowEx(
|
||||
Windows.Win32.UI.WindowsAndMessaging.WINDOW_EX_STYLE.WS_EX_LTRREADING,
|
||||
winclass_name,
|
||||
"Dummy OpenGL window",
|
||||
Windows.Win32.UI.WindowsAndMessaging.WINDOW_STYLE.WS_OVERLAPPED,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
default,
|
||||
default,
|
||||
new LibHandle(window_class.hInstance.Value, false),
|
||||
default
|
||||
);
|
||||
if (h == default)
|
||||
{
|
||||
throw new Exception("Failed in registing OpenGL window.");
|
||||
}
|
||||
HDC hdc = PInvoke.GetDC(h);
|
||||
|
||||
PIXELFORMATDESCRIPTOR pfd = new PIXELFORMATDESCRIPTOR();
|
||||
pfd.nSize = (ushort)Marshal.SizeOf(pfd);
|
||||
pfd.nVersion = 1;
|
||||
pfd.dwFlags = PFD_FLAGS.PFD_DRAW_TO_WINDOW | PFD_FLAGS.PFD_SUPPORT_OPENGL
|
||||
| PFD_FLAGS.PFD_DOUBLEBUFFER;
|
||||
pfd.iPixelType = PFD_PIXEL_TYPE.PFD_TYPE_RGBA;
|
||||
pfd.cColorBits = 32;
|
||||
pfd.cDepthBits = 24;
|
||||
pfd.cStencilBits = 8;
|
||||
pfd.iLayerType = PFD_LAYER_TYPE.PFD_MAIN_PLANE;
|
||||
|
||||
int pixelFormat = PInvoke.ChoosePixelFormat(hdc, &pfd);
|
||||
|
||||
if (pixelFormat == 0)
|
||||
{
|
||||
throw new Exception("Failed in registing OpenGL window.");
|
||||
}
|
||||
if (PInvoke.SetPixelFormat(hdc, pixelFormat, &pfd))
|
||||
{
|
||||
throw new Exception("Failed in registing OpenGL window.");
|
||||
}
|
||||
HGLRC hglrc = PInvoke.wglCreateContext(hdc);
|
||||
|
||||
PInvoke.wglMakeCurrent(hdc, hglrc);
|
||||
|
||||
wglEx.LoadWGLex();
|
||||
|
||||
PInvoke.wglMakeCurrent(hdc, HGLRC.Null);
|
||||
PInvoke.wglDeleteContext(hglrc);
|
||||
PInvoke.ReleaseDC(h, hdc);
|
||||
PInvoke.DestroyWindow(h);
|
||||
|
||||
}
|
||||
|
||||
internal static unsafe HGLRC InitGL(HDC realHDC)
|
||||
{
|
||||
CreatDummyContext();
|
||||
|
||||
int[] pixelFormatAttribute = new int[] {
|
||||
WGLconst.DRAW_TO_WINDOW_ARB, 1,
|
||||
WGLconst.SUPPORT_OPENGL_ARB, 1,
|
||||
WGLconst.DOUBLE_BUFFER_ARB, 1,
|
||||
WGLconst.ACCELERATION_ARB, WGLconst.FULL_ACCELERATION_ARB,
|
||||
WGLconst.PIXEL_TYPE_ARB, WGLconst.TYPE_RGBA_ARB,
|
||||
WGLconst.COLOR_BITS_ARB, 32,
|
||||
WGLconst.DEPTH_BITS_ARB, 24,
|
||||
WGLconst.STENCIL_BITS_ARB,8
|
||||
};
|
||||
|
||||
int piFormat;
|
||||
uint length;
|
||||
|
||||
wglEx.glChoosePixelFormatARB(new DeviceContextHandle(realHDC), pixelFormatAttribute, out piFormat, out length);
|
||||
if (length == 0)
|
||||
{
|
||||
throw new Exception("Failed in creating OpenGL core profile.");
|
||||
}
|
||||
PIXELFORMATDESCRIPTOR pfd = default;
|
||||
PInvoke.DescribePixelFormat(realHDC, piFormat, (uint)Marshal.SizeOf(pfd), &pfd);
|
||||
if (PInvoke.SetPixelFormat(realHDC, piFormat, in pfd))
|
||||
{
|
||||
throw new Exception("Failed in creating OpenGL core profile.");
|
||||
}
|
||||
int[] glVersionAttribute = new int[] {
|
||||
WGLconst.CONTEXT_MAJOR_VERSION_ARB,4,
|
||||
WGLconst.CONTEXT_MINOR_VERSION_ARB,6,
|
||||
WGLconst.CONTEXT_PROFILE_MASK_ARB, WGLconst.CONTEXT_CORE_PROFILE_BIT_ARB
|
||||
};
|
||||
|
||||
HGLRC coreGL = new(wglEx.wglCreateContextAttribsARB(
|
||||
new DeviceContextHandle(realHDC), GlRenderContextHandle.Null, glVersionAttribute).Value);
|
||||
if (coreGL.Value == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("Failed in creating OpenGL core profile.");
|
||||
}
|
||||
|
||||
return coreGL;
|
||||
|
||||
}
|
||||
|
||||
internal static unsafe LRESULT window_callback(
|
||||
HWND window, uint msg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
LRESULT ret = new LRESULT(0);
|
||||
switch (msg)
|
||||
{
|
||||
case 0x0010: break;
|
||||
case 0x0002:
|
||||
PInvoke.PostQuitMessage(0);
|
||||
break;
|
||||
default:
|
||||
ret = PInvoke.DefWindowProc(window, msg, wparam, lparam);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
internal static unsafe IntPtr CreateForm(HINSTANCE inst)
|
||||
{
|
||||
string formName = "Hello Stg#!";
|
||||
|
||||
WNDCLASSW window_class = new WNDCLASSW()
|
||||
{
|
||||
style = WNDCLASS_STYLES.CS_VREDRAW | WNDCLASS_STYLES.CS_HREDRAW | WNDCLASS_STYLES.CS_OWNDC,
|
||||
lpfnWndProc = window_callback,
|
||||
hInstance = inst,
|
||||
hCursor = new HCURSOR(PInvoke.LoadCursor(default, "IDC_ARROW").DangerousGetHandle()),
|
||||
hbrBackground = HBRUSH.Null,
|
||||
lpszClassName = new PCWSTR((char*)Marshal.StringToHGlobalUni(formName))
|
||||
};
|
||||
|
||||
if (PInvoke.RegisterClass(in window_class) == 0)
|
||||
{
|
||||
throw new Exception("Failed to create window instace.");
|
||||
}
|
||||
|
||||
RECT rect = default;
|
||||
rect.right = 1024;
|
||||
rect.bottom = 576;
|
||||
|
||||
uint window_style = WGLconst.WS_OVERLAPPEDWINDOW;
|
||||
PInvoke.AdjustWindowRect(ref rect, (WINDOW_STYLE)window_style, false);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma warning restore CA1416 // 验证平台兼容性
|
||||
#endif
|
||||
@@ -1,279 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
||||
|
||||
#if Windows
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Graphics.OpenGL;
|
||||
using Windows.Win32.Graphics.Gdi;
|
||||
|
||||
namespace StgSharp.Envitronment.Win32
|
||||
{
|
||||
public readonly partial struct DeviceContextHandle
|
||||
: IEquatable<DeviceContextHandle>
|
||||
{
|
||||
internal readonly IntPtr Value;
|
||||
|
||||
internal DeviceContextHandle(nint value) => this.Value = value;
|
||||
|
||||
public static explicit operator DeviceContextHandle(IntPtr value) => new DeviceContextHandle(value);
|
||||
|
||||
public static implicit operator IntPtr(DeviceContextHandle value) => value.Value;
|
||||
public static bool operator !=(DeviceContextHandle left, DeviceContextHandle right) => !(left == right);
|
||||
|
||||
public static bool operator ==(DeviceContextHandle left, DeviceContextHandle right) => left.Value == right.Value;
|
||||
public bool Equals(DeviceContextHandle other) => this.Value == other.Value;
|
||||
|
||||
public override bool Equals(object obj) => obj is DeviceContextHandle other && this.Equals(other);
|
||||
|
||||
public override int GetHashCode() => this.Value.GetHashCode();
|
||||
|
||||
public override string ToString() => $"0x{this.Value:x}";
|
||||
}
|
||||
|
||||
public readonly partial struct GlRenderContextHandle
|
||||
: IEquatable<GlRenderContextHandle>
|
||||
{
|
||||
internal readonly IntPtr Value;
|
||||
|
||||
internal GlRenderContextHandle(IntPtr value) => this.Value = value;
|
||||
|
||||
internal static GlRenderContextHandle Null => default;
|
||||
|
||||
internal bool IsNull => Value == default;
|
||||
|
||||
public static explicit operator GlRenderContextHandle(IntPtr value) => new GlRenderContextHandle(value);
|
||||
|
||||
public static implicit operator IntPtr(GlRenderContextHandle value) => value.Value;
|
||||
public static bool operator !=(GlRenderContextHandle left, GlRenderContextHandle right) => !(left == right);
|
||||
|
||||
public static bool operator ==(GlRenderContextHandle left, GlRenderContextHandle right) => left.Value == right.Value;
|
||||
public bool Equals(GlRenderContextHandle other) => this.Value == other.Value;
|
||||
|
||||
public override bool Equals(object obj) => obj is GlRenderContextHandle other && this.Equals(other);
|
||||
|
||||
public override int GetHashCode() => this.Value.GetHashCode();
|
||||
|
||||
public override string ToString() => $"0x{this.Value:x}";
|
||||
}
|
||||
|
||||
public struct WGLconst
|
||||
{
|
||||
#region Attribute
|
||||
public const int ACCELERATION_ARB = 0x2003;
|
||||
public const int ACCUM_ALPHA_BITS_ARB = 0x2021;
|
||||
public const int ACCUM_BITS_ARB = 0x201D;
|
||||
public const int ACCUM_BLUE_BITS_ARB = 0x2020;
|
||||
public const int ACCUM_GREEN_BITS_ARB = 0x201F;
|
||||
public const int ACCUM_RED_BITS_ARB = 0x201E;
|
||||
public const int ALPHA_BITS_ARB = 0x201B;
|
||||
public const int ALPHA_SHIFT_ARB = 0x201C;
|
||||
public const int AUX_BUFFERS_ARB = 0x2024;
|
||||
public const int BLUE_BITS_ARB = 0x2019;
|
||||
public const int BLUE_SHIFT_ARB = 0x201A;
|
||||
public const int COLOR_BITS_ARB = 0x2014;
|
||||
public const int DEPTH_BITS_ARB = 0x2022;
|
||||
public const int DOUBLE_BUFFER_ARB = 0x2011;
|
||||
public const int DRAW_TO_BITMAP_ARB = 0x2002;
|
||||
public const int DRAW_TO_WINDOW_ARB = 0x2001;
|
||||
public const int FULL_ACCELERATION_ARB = 0x2027;
|
||||
public const int GENERIC_ACCELERATION_ARB = 0x2026;
|
||||
public const int GREEN_BITS_ARB = 0x2017;
|
||||
public const int GREEN_SHIFT_ARB = 0x2018;
|
||||
public const int NEED_PALETTE_ARB = 0x2004;
|
||||
public const int NEED_SYSTEM_PALETTE_ARB = 0x2005;
|
||||
public const int NO_ACCELERATION_ARB = 0x2025;
|
||||
public const int NUMBER_OVERLAYS_ARB = 0x2008;
|
||||
public const int NUMBER_PIXEL_FORMATS_ARB = 0x2000;
|
||||
public const int NUMBER_UNDERLAYS_ARB = 0x2009;
|
||||
public const int PIXEL_TYPE_ARB = 0x2013;
|
||||
public const int RED_BITS_ARB = 0x2015;
|
||||
public const int RED_SHIFT_ARB = 0x2016;
|
||||
public const int SHARE_ACCUM_ARB = 0x200E;
|
||||
public const int SHARE_DEPTH_ARB = 0x200C;
|
||||
public const int SHARE_STENCIL_ARB = 0x200D;
|
||||
public const int STENCIL_BITS_ARB = 0x2023;
|
||||
public const int STEREO_ARB = 0x2012;
|
||||
public const int SUPPORT_GDI_ARB = 0x200F;
|
||||
public const int SUPPORT_OPENGL_ARB = 0x2010;
|
||||
public const int SWAP_COPY_ARB = 0x2029;
|
||||
public const int SWAP_EXCHANGE_ARB = 0x2028;
|
||||
public const int SWAP_LAYER_BUFFERS_ARB = 0x2006;
|
||||
public const int SWAP_METHOD_ARB = 0x2007;
|
||||
public const int SWAP_UNDEFINED_ARB = 0x202A;
|
||||
public const int TRANSPARENT_ALPHA_VALUE_ARB = 0x203A;
|
||||
public const int TRANSPARENT_ARB = 0x200A;
|
||||
public const int TRANSPARENT_BLUE_VALUE_ARB = 0x2039;
|
||||
public const int TRANSPARENT_GREEN_VALUE_ARB = 0x2038;
|
||||
public const int TRANSPARENT_INDEX_VALUE_ARB = 0x203B;
|
||||
public const int TRANSPARENT_RED_VALUE_ARB = 0x2037;
|
||||
public const int TYPE_COLORINDEX_ARB = 0x202C;
|
||||
public const int TYPE_RGBA_ARB = 0x202B;
|
||||
#endregion
|
||||
#region context
|
||||
|
||||
public const int CONTEXT_MAJOR_VERSION_ARB = 0x2091;
|
||||
public const int CONTEXT_MINOR_VERSION_ARB = 0x2092;
|
||||
public const int CONTEXT_LAYER_PLANE_ARB = 0x2093;
|
||||
public const int CONTEXT_FLAGS_ARB = 0x2094;
|
||||
public const int CONTEXT_PROFILE_MASK_ARB = 0x9126;
|
||||
public const int CONTEXT_DEBUG_BIT_ARB = 0x0001;
|
||||
public const int CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002;
|
||||
public const int CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001;
|
||||
public const int CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002;
|
||||
public const int ERROR_INVALID_VERSION_ARB = 0x2095;
|
||||
public const int ERROR_INVALID_PROFILE_ARB = 0x2096;
|
||||
|
||||
#endregion
|
||||
#region
|
||||
|
||||
public const uint WS_OVERLAPPED = 0x00000000;
|
||||
public const uint WS_POPUP = 0x80000000;
|
||||
public const uint WS_CHILD = 0x40000000;
|
||||
public const uint WS_MINIMIZE = 0x20000000;
|
||||
public const uint WS_VISIBLE = 0x10000000;
|
||||
public const uint WS_DISABLED = 0x08000000;
|
||||
public const uint WS_CLIPSIBLINGS = 0x04000000;
|
||||
public const uint WS_CLIPCHILDREN = 0x02000000;
|
||||
public const uint WS_MAXIMIZE = 0x01000000;
|
||||
public const uint WS_CAPTION = 0x00C00000; /* WS_BORDER | WS_DLGFRAME */
|
||||
public const uint WS_BORDER = 0x00800000;
|
||||
public const uint WS_DLGFRAME = 0x00400000;
|
||||
public const uint WS_VSCROLL = 0x00200000;
|
||||
public const uint WS_HSCROLL = 0x00100000;
|
||||
public const uint WS_SYSMENU = 0x00080000;
|
||||
public const uint WS_THICKFRAME = 0x00040000;
|
||||
public const uint WS_GROUP = 0x00020000;
|
||||
public const uint WS_TABSTOP = 0x00010000;
|
||||
public const uint WS_MINIMIZEBOX = 0x00020000;
|
||||
public const uint WS_MAXIMIZEBOX = 0x00010000;
|
||||
|
||||
public const uint WS_OVERLAPPEDWINDOW = WS_OVERLAPPED |
|
||||
WS_CAPTION |
|
||||
WS_SYSMENU |
|
||||
WS_THICKFRAME |
|
||||
WS_MINIMIZEBOX |
|
||||
WS_MAXIMIZEBOX;
|
||||
|
||||
#endregion
|
||||
}
|
||||
public readonly partial struct WindowHandle
|
||||
: IEquatable<WindowHandle>
|
||||
{
|
||||
internal readonly IntPtr Value;
|
||||
|
||||
internal WindowHandle(IntPtr value) => this.Value = value;
|
||||
|
||||
internal static WindowHandle Null => default;
|
||||
|
||||
internal bool IsNull => Value == default;
|
||||
|
||||
public static explicit operator WindowHandle(IntPtr value) => new WindowHandle(value);
|
||||
|
||||
public static implicit operator IntPtr(WindowHandle value) => value.Value;
|
||||
public static bool operator !=(WindowHandle left, WindowHandle right) => !(left == right);
|
||||
|
||||
public static bool operator ==(WindowHandle left, WindowHandle right) => left.Value == right.Value;
|
||||
public bool Equals(WindowHandle other) => this.Value == other.Value;
|
||||
|
||||
public override bool Equals(object obj) => obj is WindowHandle other && this.Equals(other);
|
||||
|
||||
public override int GetHashCode() => this.Value.GetHashCode();
|
||||
|
||||
public override string ToString() => $"0x{this.Value:x}";
|
||||
|
||||
//public static implicit operator HANDLE(WindowHandle value) => new HANDLE(value.Value);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class PixelFormatDescriptor
|
||||
{
|
||||
// 定义类的成员变量,使用与 C/C++ 中相同的数据类型
|
||||
public ushort nSize;
|
||||
public ushort nVersion;
|
||||
public uint dwFlags;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte iPixelType;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cColorBits;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cRedBits;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cRedShift;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cGreenBits;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cGreenShift;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cBlueBits;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cBlueShift;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cAlphaBits;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cAlphaShift;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cAccumBits;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cAccumRedBits;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cAccumGreenBits;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cAccumBlueBits;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cAccumAlphaBits;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cDepthBits;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cStencilBits;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte cAuxBuffers;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte iLayerType;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public byte bReserved;
|
||||
public uint dwLayerMask;
|
||||
public uint dwVisibleMask;
|
||||
public uint dwDamageMask;
|
||||
|
||||
// 定义一个构造函数,用于设置类的成员变量的默认值
|
||||
public PixelFormatDescriptor()
|
||||
{
|
||||
nSize = (ushort)Marshal.SizeOf(this); // 设置 nSize 为类的大小
|
||||
nVersion = 1; // 设置 nVersion 为 1
|
||||
dwFlags = 0; // 设置 dwFlags 为 0
|
||||
iPixelType = 0; // 设置 iPixelType 为 0
|
||||
cColorBits = 0; // 设置 cColorBits 为 0
|
||||
cRedBits = 0; // 设置 cRedBits 为 0
|
||||
cRedShift = 0; // 设置 cRedShift 为 0
|
||||
cGreenBits = 0; // 设置 cGreenBits 为 0
|
||||
cGreenShift = 0; // 设置 cGreenShift 为 0
|
||||
cBlueBits = 0; // 设置 cBlueBits 为 0
|
||||
cBlueShift = 0; // 设置 cBlueShift 为 0
|
||||
cAlphaBits = 0; // 设置 cAlphaBits 为 0
|
||||
cAlphaShift = 0; // 设置 cAlphaShift 为 0
|
||||
cAccumBits = 0; // 设置 cAccumBits 为 0
|
||||
cAccumRedBits = 0; // 设置 cAccumRedBits 为 0
|
||||
cAccumGreenBits = 0; // 设置 cAccumGreenBits 为 0
|
||||
cAccumBlueBits = 0; // 设置 cAccumBlueBits 为 0
|
||||
cAccumAlphaBits = 0; // 设置 cAccumAlphaBits 为 0
|
||||
cDepthBits = 0; // 设置 cDepthBits 为 0
|
||||
cStencilBits = 0; // 设置 cStencilBits 为 0
|
||||
cAuxBuffers = 0; // 设置 cAuxBuffers 为 0
|
||||
iLayerType = 0; // 设置 iLayerType 为 0
|
||||
bReserved = 0; // 设置 bReserved 为 0
|
||||
dwLayerMask = 0; // 设置 dwLayerMask 为 0
|
||||
dwVisibleMask = 0; // 设置 dwVisibleMask 为 0
|
||||
dwDamageMask = 0; // 设置 dwDamageMask 为 0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Windows.Win32.Foundation;
|
||||
|
||||
|
||||
#if Windows
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Graphics.OpenGL;
|
||||
using Windows.Win32.Graphics.Gdi;
|
||||
|
||||
namespace StgSharp.Envitronment.Win32
|
||||
{
|
||||
public class WGL
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static GlRenderContextHandle CreateContext(DeviceContextHandle param0)
|
||||
{
|
||||
return new(PInvoke.wglCreateContext(new HDC(param0.Value)).Value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,78 +0,0 @@
|
||||
using StgSharp.Envitronment.Win32;
|
||||
using StgSharp.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
#if Windows
|
||||
#pragma warning disable CA1416
|
||||
|
||||
using Windows.Win32.Graphics.Gdi;
|
||||
using Windows.Win32.Graphics.OpenGL;
|
||||
|
||||
|
||||
namespace StgSharpDebug.Environment
|
||||
{
|
||||
public static unsafe class wglEx
|
||||
{
|
||||
|
||||
private static delegate* unmanaged[Stdcall]<HDC, int*, float*, uint, int*, uint*, bool> wglChoosePixelFormatARBpointer;
|
||||
private static delegate* unmanaged[Stdcall]<HDC, HGLRC, int*, HGLRC> wglCreateContextAttribsARBpointer;
|
||||
|
||||
public static unsafe bool glChoosePixelFormatARB(
|
||||
DeviceContextHandle hdc,
|
||||
int[] pixelIntAttributeList,
|
||||
out int piFormats,
|
||||
out uint piFormatCount)
|
||||
{
|
||||
if ((ulong)wglChoosePixelFormatARBpointer < 10)
|
||||
{
|
||||
piFormats = 0;
|
||||
piFormatCount = 0;
|
||||
return false;
|
||||
}
|
||||
pixelIntAttributeList = pixelIntAttributeList.Concat([0]).ToArray();
|
||||
int pf;
|
||||
uint nf;
|
||||
fixed (int* pial = pixelIntAttributeList)
|
||||
{
|
||||
bool ret = wglChoosePixelFormatARBpointer(new HDC(hdc.Value), pial, (float*)0, 1, &pf, &nf);
|
||||
piFormats = pf;
|
||||
piFormatCount = nf;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public static unsafe GlRenderContextHandle wglCreateContextAttribsARB(
|
||||
DeviceContextHandle hdc,
|
||||
GlRenderContextHandle hglrc,
|
||||
int[] pixelFormat)
|
||||
{
|
||||
if ((ulong)wglCreateContextAttribsARBpointer < 10)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
HGLRC h, h_share = new HGLRC(hglrc.Value);
|
||||
HDC h_dc = new HDC(hdc.Value);
|
||||
fixed (int* format = pixelFormat)
|
||||
{
|
||||
h = wglCreateContextAttribsARBpointer(h_dc, h_share, format);
|
||||
return new GlRenderContextHandle(h);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void LoadWGLex()
|
||||
{
|
||||
wglChoosePixelFormatARBpointer = (delegate* unmanaged[Stdcall]<HDC, int*, float*, uint, int*, uint*, bool>)glManager.LoadGLfunc("wglChoosePixelFormatARB");
|
||||
wglCreateContextAttribsARBpointer = (delegate* unmanaged[Stdcall]<HDC, HGLRC, int*, HGLRC>)glManager.LoadGLfunc("wglCreateContextAttribsARB");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#pragma warning restore CA1416 // 验证平台兼容性
|
||||
#endif
|
||||
@@ -19,13 +19,13 @@ using System.Threading;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
public abstract partial class Form
|
||||
{
|
||||
#region metadata
|
||||
|
||||
internal LinkedList<Control> allControl;
|
||||
internal Vector4 backgroundColor;
|
||||
internal unsafe GLcontext* contextID;
|
||||
@@ -38,20 +38,25 @@ namespace StgSharp.Graphics
|
||||
internal IntPtr windowID;
|
||||
private bool closed;
|
||||
internal IglFunc gl;
|
||||
#endregion
|
||||
|
||||
#endregion metadata
|
||||
|
||||
#region form thread setting
|
||||
|
||||
internal FrameUpdateTimer timer = new FrameUpdateTimer();
|
||||
private SemaphoreSlim _renderFinishSignal = new SemaphoreSlim(0, 1);
|
||||
private SemaphoreSlim _renderStartSignal = new SemaphoreSlim(1, 1);
|
||||
private bool isSingleThread = true;
|
||||
private Thread renderThread;
|
||||
#endregion
|
||||
|
||||
#endregion form thread setting
|
||||
|
||||
#region glapicount
|
||||
|
||||
private int missingAPIcount = 0;
|
||||
private int problemAPIcount = 0;
|
||||
#endregion
|
||||
|
||||
#endregion glapicount
|
||||
|
||||
protected Form()
|
||||
{
|
||||
@@ -76,7 +81,7 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Representing
|
||||
/// Representing
|
||||
/// </summary>
|
||||
public bool IsDoubleRendering
|
||||
{
|
||||
@@ -143,6 +148,7 @@ namespace StgSharp.Graphics
|
||||
InternalIO.glfwSetFramebufferSizeCallback(windowID, handlerPtr);
|
||||
}
|
||||
}
|
||||
|
||||
unsafe ~Form()
|
||||
{
|
||||
Marshal.FreeHGlobal((IntPtr)contextID);
|
||||
@@ -152,7 +158,7 @@ namespace StgSharp.Graphics
|
||||
/// Init an OpenGl context if current form has not been binded to any context.
|
||||
/// and set the context binded to current form as current OpenGL context.
|
||||
/// </summary>
|
||||
/// <exception cref="Exception">Something goes wrong and
|
||||
/// <exception cref="Exception">Something goes wrong and
|
||||
/// StgSharp fails in creating a new OpenGL context. </exception>
|
||||
public unsafe void MakeAsCurrentContext()
|
||||
{
|
||||
@@ -179,6 +185,7 @@ namespace StgSharp.Graphics
|
||||
windowID = windowPtr;
|
||||
}
|
||||
}
|
||||
InternalIO.glfwMakeContextCurrent(windowID);
|
||||
gl.SwitchContext();
|
||||
}
|
||||
|
||||
@@ -210,14 +217,13 @@ namespace StgSharp.Graphics
|
||||
/// Resize the current form
|
||||
/// </summary>
|
||||
/// <param name="size">
|
||||
/// A <see cref="Vec2d"/> (width,height) representing the new size of current form
|
||||
/// A <see cref="Vec2d"/> (width,height) representing the new size of current form
|
||||
/// </param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetSize(Vec2d size)
|
||||
{
|
||||
this.Size = size;
|
||||
InternalIO.glfwSetWindowSize(this.windowID, (int)size.X, (int)size.Y);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -293,12 +299,11 @@ namespace StgSharp.Graphics
|
||||
|
||||
/// <summary>
|
||||
/// Behaviour of current form when in a render cycle.
|
||||
/// When this form
|
||||
/// When this form
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
public abstract void Main(params object[] args);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Init this form and render it on screen, and respond with operation
|
||||
/// </summary>
|
||||
@@ -408,6 +413,7 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion form main
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
@@ -9,7 +10,6 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
public unsafe class Texture
|
||||
{
|
||||
internal static bool[] unitActivated = new bool[16];
|
||||
@@ -43,10 +43,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
Image.ImageInfo info = default;
|
||||
InternalIO.InternalLoadImage(name, &info, loader);
|
||||
Console.WriteLine(info);
|
||||
sourceList[index] = new Image(info);
|
||||
InternalIO.InternalUnloadImage(&info);
|
||||
Console.WriteLine(sourceList[index]);
|
||||
if (sourceList[index].info.pixelPtr != IntPtr.Zero)
|
||||
{
|
||||
uint channel;
|
||||
@@ -67,7 +64,8 @@ namespace StgSharp.Graphics
|
||||
GL.TextureImage2d<byte>(
|
||||
GLconst.TEXTURE_2D, 0, channel,
|
||||
(uint)sourceList[index].Width, (uint)sourceList[index].Height,
|
||||
channel, GLconst.UNSIGNED_BYTE, sourceList[index].pixelArray
|
||||
channel, GLconst.UNSIGNED_BYTE,
|
||||
sourceList[index].pixelArrayHandle
|
||||
);
|
||||
}
|
||||
else
|
||||
@@ -81,7 +79,7 @@ namespace StgSharp.Graphics
|
||||
GL = gl;
|
||||
}
|
||||
|
||||
#region texture set
|
||||
#region texture setting
|
||||
|
||||
public void Set2dFilterProperty(
|
||||
Filter onMinify, Filter onMagnify)
|
||||
@@ -97,7 +95,7 @@ namespace StgSharp.Graphics
|
||||
GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_WRAP_T, (int)onVertical);
|
||||
}
|
||||
|
||||
#endregion texture set
|
||||
#endregion texture setting
|
||||
}
|
||||
|
||||
public enum Filter
|
||||
@@ -137,4 +135,4 @@ namespace StgSharp.Graphics
|
||||
ClampToEdge = GLconst.CLAMP_TO_EDGE,
|
||||
ClampToBorder = GLconst.CLAMP_TO_BORDER,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,41 +9,8 @@ using System.Security.AccessControl;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
|
||||
namespace System
|
||||
{
|
||||
public unsafe struct glSHandle
|
||||
{
|
||||
internal int* valuePtr;
|
||||
internal glHandleSet source;
|
||||
|
||||
public static glSHandle Zero
|
||||
{
|
||||
get { return Alloc(1); }
|
||||
}
|
||||
|
||||
public static glSHandle Alloc(int value)
|
||||
{
|
||||
glSHandle ret = default;
|
||||
ret.source = new glHandleSet(1);
|
||||
ret.valuePtr = (int*)ret.source.handle;
|
||||
*ret.valuePtr = (int)value;
|
||||
return ret;
|
||||
}
|
||||
|
||||
internal int DirectValue
|
||||
{
|
||||
get { return *valuePtr; }
|
||||
}
|
||||
|
||||
internal glSHandle(int* val, glHandleSet set)
|
||||
{
|
||||
source = set;
|
||||
valuePtr = val;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A handle to an OpenGL object,
|
||||
/// must be indexed from a <see cref="glHandleSet"/>.
|
||||
@@ -51,26 +18,12 @@ namespace System
|
||||
/// </summary>
|
||||
public unsafe struct glHandle
|
||||
{
|
||||
internal uint* valuePtr;
|
||||
internal glHandleSet source;
|
||||
internal uint* valuePtr;
|
||||
|
||||
public static glHandle Zero
|
||||
{
|
||||
get { return Alloc(0); }
|
||||
}
|
||||
|
||||
[Obsolete("Cannot init instance of this type", true)]
|
||||
public glHandle()
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
public static glHandle Alloc(uint value)
|
||||
{
|
||||
glHandle ret = default;
|
||||
ret.source = new glHandleSet(1);
|
||||
ret.valuePtr = ret.source.handle;
|
||||
*ret.valuePtr = value;
|
||||
return ret;
|
||||
}
|
||||
|
||||
internal glHandle(uint* val, glHandleSet set)
|
||||
@@ -79,6 +32,17 @@ namespace System
|
||||
valuePtr = val;
|
||||
}
|
||||
|
||||
private glHandle(IntPtr handle)
|
||||
{
|
||||
this.valuePtr = (uint*)handle;
|
||||
source = null;
|
||||
}
|
||||
|
||||
public static glHandle Zero
|
||||
{
|
||||
get { return Alloc(0); }
|
||||
}
|
||||
|
||||
public IntPtr Handle
|
||||
{
|
||||
get
|
||||
@@ -91,14 +55,6 @@ namespace System
|
||||
}
|
||||
}
|
||||
|
||||
internal uint DirectValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return *valuePtr;
|
||||
}
|
||||
}
|
||||
|
||||
public uint Value
|
||||
{
|
||||
get
|
||||
@@ -118,6 +74,60 @@ namespace System
|
||||
*valuePtr = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal uint DirectValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return *valuePtr;
|
||||
}
|
||||
}
|
||||
|
||||
public static glHandle Alloc(uint value)
|
||||
{
|
||||
glHandle ret = default;
|
||||
ret.source = new glHandleSet(1);
|
||||
ret.valuePtr = ret.source.handle;
|
||||
*ret.valuePtr = value;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static glHandle Alloc(IntPtr handle)
|
||||
{
|
||||
return new glHandle(handle);
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe struct glSHandle
|
||||
{
|
||||
internal glHandleSet source;
|
||||
internal int* valuePtr;
|
||||
|
||||
internal glSHandle(int* val, glHandleSet set)
|
||||
{
|
||||
source = set;
|
||||
valuePtr = val;
|
||||
}
|
||||
|
||||
public static glSHandle Zero
|
||||
{
|
||||
get { return Alloc(1); }
|
||||
}
|
||||
|
||||
internal int DirectValue
|
||||
{
|
||||
get { return *valuePtr; }
|
||||
}
|
||||
|
||||
public static glSHandle Alloc(int value)
|
||||
{
|
||||
glSHandle ret = default;
|
||||
ret.source = new glHandleSet(1);
|
||||
ret.valuePtr = (int*)ret.source.handle;
|
||||
*ret.valuePtr = (int)value;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -125,24 +135,15 @@ namespace System
|
||||
/// </summary>
|
||||
public unsafe class glHandleSet
|
||||
{
|
||||
private readonly uint[] _value;
|
||||
internal int length;
|
||||
internal uint* handle;
|
||||
internal int length;
|
||||
private readonly uint[] _value;
|
||||
|
||||
public static void Copy(in glHandleSet source, glHandleSet target)
|
||||
public glHandleSet(int count)
|
||||
{
|
||||
if (source == null || target == null)
|
||||
{
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
if (source.length != target.length)
|
||||
{
|
||||
throw new Exception($"Lengths of {nameof(source)} and {nameof(target)} are not equal.");
|
||||
}
|
||||
for (int i = 0; i < source.length; i++)
|
||||
{
|
||||
target._value[i] = source._value[i];
|
||||
}
|
||||
_value = new uint[count];
|
||||
length = count;
|
||||
handle = (uint*)GCHandle.Alloc(_value, GCHandleType.Pinned).AddrOfPinnedObject();
|
||||
}
|
||||
|
||||
public glHandle this[int index]
|
||||
@@ -169,17 +170,20 @@ namespace System
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetValue(int index, uint value)
|
||||
public static void Copy(in glHandleSet source, glHandleSet target)
|
||||
{
|
||||
_value[index] = value;
|
||||
}
|
||||
|
||||
public glHandleSet(int count)
|
||||
{
|
||||
_value = new uint[count];
|
||||
length = count;
|
||||
handle = (uint*)GCHandle.Alloc(_value, GCHandleType.Pinned).AddrOfPinnedObject();
|
||||
if (source == null || target == null)
|
||||
{
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
if (source.length != target.length)
|
||||
{
|
||||
throw new Exception($"Lengths of {nameof(source)} and {nameof(target)} are not equal.");
|
||||
}
|
||||
for (int i = 0; i < source.length; i++)
|
||||
{
|
||||
target._value[i] = source._value[i];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -207,7 +211,7 @@ namespace System
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Realse all resource in this handle.
|
||||
/// Realse all resource in this handle.
|
||||
/// This will release all resource in this <see cref="glHandle"/>.
|
||||
/// This <see langword="glHandle"/> will be not usable.
|
||||
/// </summary>
|
||||
@@ -224,5 +228,10 @@ namespace System
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetValue(int index, uint value)
|
||||
{
|
||||
_value[index] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using StgSharp.Logic;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@@ -9,12 +10,10 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
internal unsafe partial class GLonRender : IglFunc
|
||||
{
|
||||
internal GLcontext* api;
|
||||
FrameTimeoutException refreshSIgnal = new FrameTimeoutException();
|
||||
|
||||
private FrameTimeoutException refreshSIgnal = new FrameTimeoutException();
|
||||
|
||||
internal GLonRender(GLcontext* context)
|
||||
{
|
||||
@@ -28,7 +27,6 @@ namespace StgSharp.Graphics
|
||||
|
||||
void IglFunc.SwitchContext()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -142,7 +140,6 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
InternalIO.InternalWriteLog(log, LogType.Error);
|
||||
|
||||
}
|
||||
handleSet.SetValue(i, shaderID);
|
||||
}
|
||||
@@ -203,6 +200,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
api->glDeleteBuffers(1, (uint*)handle.Handle);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.DeleteBuffers(glHandleSet handle)
|
||||
{
|
||||
@@ -226,12 +224,15 @@ namespace StgSharp.Graphics
|
||||
case TypeCode.UInt32:
|
||||
a = GLconst.UNSIGNED_INT;
|
||||
break;
|
||||
|
||||
case TypeCode.UInt16:
|
||||
a = GLconst.UNSIGNED_SHORT;
|
||||
break;
|
||||
|
||||
case TypeCode.Byte:
|
||||
a = GLconst.UNSIGNED_BYTE;
|
||||
break;
|
||||
|
||||
default:
|
||||
InternalIO.InternalWriteLog(
|
||||
$"Parameter error in parameter {nameof(type)} method DrawElements. " +
|
||||
@@ -257,6 +258,7 @@ namespace StgSharp.Graphics
|
||||
api->glGenTextures((uint)count, h.handle);
|
||||
return h;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe glHandleSet IglFunc.GenVertexArrays(int count)
|
||||
{
|
||||
@@ -327,16 +329,12 @@ namespace StgSharp.Graphics
|
||||
api->glEnableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void IglFunc.TextureImage2d<T>(int target, int level, uint internalformat, uint width, uint height, uint format, uint type, T[] pixels)
|
||||
void IglFunc.TextureImage2d<T>(int target, int level, uint internalformat, uint width, uint height, uint format, uint type, glHandle pixels)
|
||||
{
|
||||
Console.WriteLine(pixels);
|
||||
IntPtr source = GCHandle.Alloc(pixels, GCHandleType.Pinned).AddrOfPinnedObject();
|
||||
api->glTexImage2D(
|
||||
(uint)target, level, internalformat, width, height, 0, format, type, (void*)source
|
||||
(uint)target, level, internalformat, width, height, 0, format, type, pixels.valuePtr
|
||||
);
|
||||
GCHandle.FromIntPtr(source).Free();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -356,8 +354,5 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
api->glViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using StgSharp.Logic;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@@ -14,12 +15,13 @@ namespace StgSharp.Graphics
|
||||
private static readonly GLonTimeout singleInstance
|
||||
= new GLonTimeout();
|
||||
|
||||
FrameTimeoutException refreshSIgnal = new FrameTimeoutException();
|
||||
FrameTimeoutException signal = new FrameTimeoutException("This frame is timeout");
|
||||
private FrameTimeoutException refreshSIgnal = new FrameTimeoutException();
|
||||
private FrameTimeoutException signal = new FrameTimeoutException("This frame is timeout");
|
||||
|
||||
unsafe GLcontext* IglFunc.Context => throw signal;
|
||||
|
||||
private GLonTimeout() { }
|
||||
private GLonTimeout()
|
||||
{ }
|
||||
|
||||
void IglFunc.ActiveTexture(uint type) => throw signal;
|
||||
|
||||
@@ -43,12 +45,10 @@ namespace StgSharp.Graphics
|
||||
|
||||
glHandleSet IglFunc.CompileShader(ShaderType shaderType, params string[] shaderCode) => throw signal;
|
||||
|
||||
|
||||
glHandle IglFunc.CreateProgram() => throw signal;
|
||||
|
||||
glHandleSet IglFunc.CreateProgram(int count) => throw signal;
|
||||
|
||||
|
||||
IntPtr IglFunc.CreateWindowHandle(int width, int height, string tittle, IntPtr monitor, Form share) => throw signal;
|
||||
|
||||
glHandle IglFunc.CreatGraphicProgram() => throw signal;
|
||||
@@ -57,18 +57,14 @@ namespace StgSharp.Graphics
|
||||
|
||||
void IglFunc.DeleteBuffers(glHandleSet handle) => throw signal;
|
||||
|
||||
|
||||
void IglFunc.DeleteVertexArrays(glHandleSet handle) => throw signal;
|
||||
|
||||
|
||||
void IglFunc.DrawElements(GepmetryType mode, uint count, TypeCode type, IntPtr ptr) => throw signal;
|
||||
|
||||
glHandleSet IglFunc.GenBuffers(int count) => throw signal;
|
||||
|
||||
|
||||
glHandleSet IglFunc.GenTextures(int count) => throw signal;
|
||||
|
||||
|
||||
glHandleSet IglFunc.GenVertexArrays(int count) => throw signal;
|
||||
|
||||
unsafe glSHandle IglFunc.GetUniformLocation(glHandle program, string name) => throw signal;
|
||||
@@ -97,7 +93,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
void IglFunc.SetVertexAttribute(uint index, int size, TypeCode t, bool normalized, uint stride, int pointer) => throw signal;
|
||||
|
||||
unsafe void IglFunc.TextureImage2d<T>(int target, int level, uint internalformat, uint width, uint height, uint format, uint type, T[] pixels) => throw signal;
|
||||
unsafe void IglFunc.TextureImage2d<T>(int target, int level, uint internalformat, uint width, uint height, uint format, uint type, glHandle pixels) => throw signal;
|
||||
|
||||
void IglFunc.TextureParameter(int target, uint pname, int param) => throw signal;
|
||||
|
||||
@@ -112,4 +108,4 @@ namespace StgSharp.Graphics
|
||||
throw signal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using StgSharp.Logic;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,8 +13,6 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
|
||||
internal unsafe partial class GLonUpdate : IglFunc
|
||||
{
|
||||
private static ConcurrentQueue<IntPtr> glActionQueue;
|
||||
@@ -139,7 +138,7 @@ namespace StgSharp.Graphics
|
||||
for (int i = 0; i < l; i++)
|
||||
{
|
||||
GCHandle codePtr = GCHandle.Alloc(Encoding.UTF8.GetBytes(shaderCode[i] + '\0'), GCHandleType.Pinned);
|
||||
paramQueue.Enqueue((IntPtr)shaderHandle.handle + i, codePtr.AddrOfPinnedObject());
|
||||
paramQueue.Enqueue((IntPtr)(shaderHandle.handle + i), codePtr.AddrOfPinnedObject());
|
||||
}
|
||||
glActionQueue.Enqueue(CompileShaderPtr);
|
||||
return shaderHandle;
|
||||
@@ -235,12 +234,15 @@ namespace StgSharp.Graphics
|
||||
case TypeCode.UInt32:
|
||||
a = GLconst.UNSIGNED_INT;
|
||||
break;
|
||||
|
||||
case TypeCode.UInt16:
|
||||
a = GLconst.UNSIGNED_SHORT;
|
||||
break;
|
||||
|
||||
case TypeCode.Byte:
|
||||
a = GLconst.UNSIGNED_BYTE;
|
||||
break;
|
||||
|
||||
default:
|
||||
InternalIO.InternalWriteLog(
|
||||
$"Parameter error in parameter {type} method DrawElements. " +
|
||||
@@ -343,13 +345,12 @@ namespace StgSharp.Graphics
|
||||
//TODO:双线程,换运行环境
|
||||
void IglFunc.SwitchContext()
|
||||
{
|
||||
|
||||
paramQueue.context = api;
|
||||
}
|
||||
|
||||
unsafe void IglFunc.TextureImage2d<T>(int target, int level, uint internalformat, uint width, uint height, uint format, uint type, T[] pixels)
|
||||
unsafe void IglFunc.TextureImage2d<T>(int target, int level, uint internalformat, uint width, uint height, uint format, uint type, glHandle pixels)
|
||||
{
|
||||
IntPtr source = GCHandle.Alloc(pixels, GCHandleType.Pinned).AddrOfPinnedObject();
|
||||
paramQueue.Enqueue(source);
|
||||
paramQueue.Enqueue(pixels);
|
||||
paramQueue.Enqueue((uint)level, internalformat, width, height);
|
||||
paramQueue.Enqueue((uint)target, format, type);
|
||||
glActionQueue.Enqueue(textureImage2dPtr);
|
||||
@@ -388,4 +389,4 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using StgSharp.Logic;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@@ -101,6 +102,9 @@ namespace StgSharp.Graphics
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
paramQueue.TryDequeue(out shaderHandle, out codeHandle);
|
||||
GCHandle code = GCHandle.FromIntPtr(codeHandle);
|
||||
byte[] c = (byte[])code.Target;
|
||||
Console.WriteLine(Encoding.UTF8.GetString(c));
|
||||
*(uint*)shaderHandle = InternalIO.InternalLoadShaderCode(paramQueue.context, (byte*)codeHandle, type);
|
||||
if (*(uint*)shaderHandle == 0)
|
||||
{
|
||||
@@ -275,4 +279,4 @@ namespace StgSharp.Graphics
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,141 +1,258 @@
|
||||
using StgSharp.Graphics;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
#if Windows
|
||||
using Windows.Win32;
|
||||
// using Windows.Win32;
|
||||
#endif
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
internal partial class InternalIO
|
||||
{
|
||||
#region api call
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwInit")] internal extern unsafe static int glfwInit();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwTerminate")] internal extern unsafe static void glfwTerminate();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwInitHint")] internal extern unsafe static void glfwInitHint(int hint, int value);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVersion")] internal extern unsafe static void glfwGetVersion(int* major, int* minor, int* rev);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVersionString")] internal extern unsafe static byte* glfwGetVersionString();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetError")] internal extern unsafe static int glfwGetError(byte** description);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetErrorCallback")] internal extern unsafe static GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitors")] internal extern unsafe static IntPtr* glfwGetMonitors(int* count);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetPrimaryMonitor")] internal extern unsafe static IntPtr glfwGetPrimaryMonitor();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorPos")] internal extern unsafe static void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorWorkarea")] internal extern unsafe static void glfwGetMonitorWorkarea(IntPtr monitor, int* xpos, int* ypos, int* width, int* height);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorPhysicalSize")] internal extern unsafe static void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorContentScale")] internal extern unsafe static void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorName")] internal extern unsafe static byte* glfwGetMonitorName(IntPtr monitor);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetMonitorUserPointer")] internal extern unsafe static void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorUserPointer")] internal extern unsafe static void* glfwGetMonitorUserPointer(IntPtr monitor);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetMonitorCallback")] internal extern unsafe static GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVideoModes")] internal extern unsafe static GLFWvidmode* glfwGetVideoModes(IntPtr monitor, int* count);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVideoMode")] internal extern unsafe static GLFWvidmode* glfwGetVideoMode(IntPtr monitor);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetGamma")] internal extern unsafe static void glfwSetGamma(IntPtr monitor, float gamma);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetGammaRamp")] internal extern unsafe static GLFWgammaramp* glfwGetGammaRamp(IntPtr monitor);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetGammaRamp")] internal extern unsafe static void glfwSetGammaRamp(IntPtr monitor, GLFWgammaramp* ramp);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwDefaultWindowHints")] internal extern unsafe static void glfwDefaultWindowHints();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWindowHint")] internal extern unsafe static void glfwWindowHint(int hint, int value);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWindowHintString")] internal extern unsafe static void glfwWindowHintString(int hint, byte* value);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwCreateWindow")] internal extern unsafe static IntPtr glfwCreateWindow(int width, int height, byte[] title, IntPtr monitor, IntPtr share);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwDestroyWindow")] internal extern unsafe static void glfwDestroyWindow(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWindowShouldClose")] internal extern unsafe static int glfwWindowShouldClose(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowShouldClose")] internal extern unsafe static void glfwSetWindowShouldClose(IntPtr window, int value);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowTitle")] internal extern unsafe static void glfwSetWindowTitle(IntPtr window, byte* title);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowIcon")] internal extern unsafe static void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowPos")] internal extern unsafe static void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowPos")] internal extern unsafe static void glfwSetWindowPos(IntPtr window, int xpos, int ypos);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowSize")] internal extern unsafe static void glfwGetWindowSize(IntPtr window, int* width, int* height);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSizeLimits")] internal extern unsafe static void glfwSetWindowSizeLimits(IntPtr window, int minwidth, int minheight, int maxwidth, int maxheight);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowAspectRatio")] internal extern unsafe static void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSize")] internal extern unsafe static void glfwSetWindowSize(IntPtr window, int width, int height);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetFramebufferSize")] internal extern unsafe static void glfwGetFramebufferSize(IntPtr window, int* width, int* height);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowFrameSize")] internal extern unsafe static void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowContentScale")] internal extern unsafe static void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowOpacity")] internal extern unsafe static float glfwGetWindowOpacity(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowOpacity")] internal extern unsafe static void glfwSetWindowOpacity(IntPtr window, float opacity);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwIconifyWindow")] internal extern unsafe static void glfwIconifyWindow(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwRestoreWindow")] internal extern unsafe static void glfwRestoreWindow(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwMaximizeWindow")] internal extern unsafe static void glfwMaximizeWindow(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwShowWindow")] internal extern unsafe static void glfwShowWindow(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwHideWindow")] internal extern unsafe static void glfwHideWindow(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwFocusWindow")] internal extern unsafe static void glfwFocusWindow(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwRequestWindowAttention")] internal extern unsafe static void glfwRequestWindowAttention(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowMonitor")] internal extern unsafe static IntPtr glfwGetWindowMonitor(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowMonitor")] internal extern unsafe static void glfwSetWindowMonitor(IntPtr window, IntPtr monitor, int xpos, int ypos, int width, int height, int refreshRate);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowAttrib")] internal extern unsafe static int glfwGetWindowAttrib(IntPtr window, int attrib);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowAttrib")] internal extern unsafe static void glfwSetWindowAttrib(IntPtr window, int attrib, int value);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowUserPointer")] internal extern unsafe static void glfwSetWindowUserPointer(IntPtr window, void* pointer);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowUserPointer")] internal extern unsafe static void* glfwGetWindowUserPointer(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowPosCallback")] internal extern unsafe static GLFWwindowposfun glfwSetWindowPosCallback(IntPtr window, GLFWwindowposfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSizeCallback")] internal extern unsafe static GLFWwindowsizefun glfwSetWindowSizeCallback(IntPtr window, GLFWwindowsizefun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowCloseCallback")] internal extern unsafe static GLFWwindowclosefun glfwSetWindowCloseCallback(IntPtr window, GLFWwindowclosefun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowRefreshCallback")] internal extern unsafe static GLFWwindowrefreshfun glfwSetWindowRefreshCallback(IntPtr window, GLFWwindowrefreshfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowFocusCallback")] internal extern unsafe static GLFWwindowfocusfun glfwSetWindowFocusCallback(IntPtr window, GLFWwindowfocusfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowIconifyCallback")] internal extern unsafe static GLFWwindowiconifyfun glfwSetWindowIconifyCallback(IntPtr window, GLFWwindowiconifyfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowMaximizeCallback")] internal extern unsafe static GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(IntPtr window, GLFWwindowmaximizefun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetFramebufferSizeCallback")] internal extern unsafe static FramebuffersizeHandler glfwSetFramebufferSizeCallback(IntPtr window, IntPtr callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowContentScaleCallback")] internal extern unsafe static GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(IntPtr window, GLFWwindowcontentscalefun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwPollEvents")] internal extern unsafe static void glfwPollEvents();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWaitEvents")] internal extern unsafe static void glfwWaitEvents();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWaitEventsTimeout")] internal extern unsafe static void glfwWaitEventsTimeout(double timeout);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwPostEmptyEvent")] internal extern unsafe static void glfwPostEmptyEvent();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetInputMode")] internal extern unsafe static int glfwGetInputMode(IntPtr window, int mode);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetInputMode")] internal extern unsafe static void glfwSetInputMode(IntPtr window, int mode, int value);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwRawMouseMotionSupported")] internal extern unsafe static int glfwRawMouseMotionSupported();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetKeyName")] internal extern unsafe static byte* glfwGetKeyName(int key, int scancode);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetKeyScancode")] internal extern unsafe static int glfwGetKeyScancode(int key);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetKey")] internal extern unsafe static KeyStatus glfwGetKey(IntPtr window, int key);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMouseButton")] internal extern unsafe static int glfwGetMouseButton(IntPtr window, int button);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetCursorPos")] internal extern unsafe static void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorPos")] internal extern unsafe static void glfwSetCursorPos(IntPtr window, double xpos, double ypos);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwCreateCursor")] internal extern unsafe static GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwCreateStandardCursor")] internal extern unsafe static GLFWcursor* glfwCreateStandardCursor(int shape);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwDestroyCursor")] internal extern unsafe static void glfwDestroyCursor(GLFWcursor* cursor);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursor")] internal extern unsafe static void glfwSetCursor(IntPtr window, GLFWcursor* cursor);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetKeyCallback")] internal extern unsafe static GLFWkeyfun glfwSetKeyCallback(IntPtr window, GLFWkeyfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCharCallback")] internal extern unsafe static GLFWcharfun glfwSetCharCallback(IntPtr window, GLFWcharfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCharModsCallback")] internal extern unsafe static GLFWcharmodsfun glfwSetCharModsCallback(IntPtr window, GLFWcharmodsfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetMouseButtonCallback")] internal extern unsafe static GLFWmousebuttonfun glfwSetMouseButtonCallback(IntPtr window, GLFWmousebuttonfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorPosCallback")] internal extern unsafe static GLFWcursorposfun glfwSetCursorPosCallback(IntPtr window, GLFWcursorposfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorEnterCallback")] internal extern unsafe static GLFWcursorenterfun glfwSetCursorEnterCallback(IntPtr window, GLFWcursorenterfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetScrollCallback")] internal extern unsafe static GLFWscrollfun glfwSetScrollCallback(IntPtr window, GLFWscrollfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetDropCallback")] internal extern unsafe static GLFWdropfun glfwSetDropCallback(IntPtr window, GLFWdropfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwJoystickPresent")] internal extern unsafe static int glfwJoystickPresent(int jid);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickAxes")] internal extern unsafe static float* glfwGetJoystickAxes(int jid, int* count);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickButtons")] internal extern unsafe static byte* glfwGetJoystickButtons(int jid, int* count);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickHats")] internal extern unsafe static byte* glfwGetJoystickHats(int jid, int* count);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickName")] internal extern unsafe static byte* glfwGetJoystickName(int jid);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickGUID")] internal extern unsafe static byte* glfwGetJoystickGUID(int jid);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetJoystickUserPointer")] internal extern unsafe static void glfwSetJoystickUserPointer(int jid, void* pointer);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickUserPointer")] internal extern unsafe static void* glfwGetJoystickUserPointer(int jid);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwJoystickIsGamepad")] internal extern unsafe static int glfwJoystickIsGamepad(int jid);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetJoystickCallback")] internal extern unsafe static GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwUpdateGamepadMappings")] internal extern unsafe static int glfwUpdateGamepadMappings(byte* str);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetGamepadName")] internal extern unsafe static byte* glfwGetGamepadName(int jid);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetGamepadState")] internal extern unsafe static int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetClipboardString")] internal extern unsafe static void glfwSetClipboardString(IntPtr window, byte* str);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetClipboardString")] internal extern unsafe static byte* glfwGetClipboardString(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetTime")] internal extern unsafe static double glfwGetTime();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetTime")] internal extern unsafe static void glfwSetTime(double time);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetTimerValue")] internal extern unsafe static ulong* glfwGetTimerValue();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetTimerFrequency")] internal extern unsafe static ulong* glfwGetTimerFrequency();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwMakeContextCurrent")] internal extern unsafe static void glfwMakeContextCurrent(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetCurrentContext")] internal extern unsafe static IntPtr glfwGetCurrentContext();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSwapBuffers")] internal extern unsafe static void glfwSwapBuffers(IntPtr window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSwapInterval")] internal extern unsafe static void glfwSwapInterval(int interval);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwExtensionSupported")] internal extern unsafe static int glfwExtensionSupported(byte* extension);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetProcAddress", CharSet = CharSet.Ansi)] internal extern unsafe static IntPtr glfwGetProcAddress(string procname);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwVulkanSupported")] internal extern unsafe static int glfwVulkanSupported();
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetRequiredInstanceExtensions")] internal extern unsafe static byte** glfwGetRequiredInstanceExtensions(uint* count);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwInit")] internal static extern unsafe int glfwInit();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwTerminate")] internal static extern unsafe void glfwTerminate();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwInitHint")] internal static extern unsafe void glfwInitHint(int hint, int value);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVersion")] internal static extern unsafe void glfwGetVersion(int* major, int* minor, int* rev);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVersionString")] internal static extern unsafe byte* glfwGetVersionString();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetError")] internal static extern unsafe int glfwGetError(byte** description);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetErrorCallback")] internal static extern unsafe GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitors")] internal static extern unsafe IntPtr* glfwGetMonitors(int* count);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetPrimaryMonitor")] internal static extern unsafe IntPtr glfwGetPrimaryMonitor();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorPos")] internal static extern unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorWorkarea")] internal static extern unsafe void glfwGetMonitorWorkarea(IntPtr monitor, int* xpos, int* ypos, int* width, int* height);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorPhysicalSize")] internal static extern unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorContentScale")] internal static extern unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorName")] internal static extern unsafe byte* glfwGetMonitorName(IntPtr monitor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetMonitorUserPointer")] internal static extern unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMonitorUserPointer")] internal static extern unsafe void* glfwGetMonitorUserPointer(IntPtr monitor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetMonitorCallback")] internal static extern unsafe GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVideoModes")] internal static extern unsafe GLFWvidmode* glfwGetVideoModes(IntPtr monitor, int* count);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVideoMode")] internal static extern unsafe GLFWvidmode* glfwGetVideoMode(IntPtr monitor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetGamma")] internal static extern unsafe void glfwSetGamma(IntPtr monitor, float gamma);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetGammaRamp")] internal static extern unsafe GLFWgammaramp* glfwGetGammaRamp(IntPtr monitor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetGammaRamp")] internal static extern unsafe void glfwSetGammaRamp(IntPtr monitor, GLFWgammaramp* ramp);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwDefaultWindowHints")] internal static extern unsafe void glfwDefaultWindowHints();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWindowHint")] internal static extern unsafe void glfwWindowHint(int hint, int value);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWindowHintString")] internal static extern unsafe void glfwWindowHintString(int hint, byte* value);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwCreateWindow")] internal static extern unsafe IntPtr glfwCreateWindow(int width, int height, byte[] title, IntPtr monitor, IntPtr share);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwDestroyWindow")] internal static extern unsafe void glfwDestroyWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWindowShouldClose")] internal static extern unsafe int glfwWindowShouldClose(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowShouldClose")] internal static extern unsafe void glfwSetWindowShouldClose(IntPtr window, int value);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowTitle")] internal static extern unsafe void glfwSetWindowTitle(IntPtr window, byte* title);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowIcon")] internal static extern unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowPos")] internal static extern unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowPos")] internal static extern unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowSize")] internal static extern unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSizeLimits")] internal static extern unsafe void glfwSetWindowSizeLimits(IntPtr window, int minwidth, int minheight, int maxwidth, int maxheight);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowAspectRatio")] internal static extern unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSize")] internal static extern unsafe void glfwSetWindowSize(IntPtr window, int width, int height);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetFramebufferSize")] internal static extern unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowFrameSize")] internal static extern unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowContentScale")] internal static extern unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowOpacity")] internal static extern unsafe float glfwGetWindowOpacity(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowOpacity")] internal static extern unsafe void glfwSetWindowOpacity(IntPtr window, float opacity);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwIconifyWindow")] internal static extern unsafe void glfwIconifyWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwRestoreWindow")] internal static extern unsafe void glfwRestoreWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwMaximizeWindow")] internal static extern unsafe void glfwMaximizeWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwShowWindow")] internal static extern unsafe void glfwShowWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwHideWindow")] internal static extern unsafe void glfwHideWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwFocusWindow")] internal static extern unsafe void glfwFocusWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwRequestWindowAttention")] internal static extern unsafe void glfwRequestWindowAttention(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowMonitor")] internal static extern unsafe IntPtr glfwGetWindowMonitor(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowMonitor")] internal static extern unsafe void glfwSetWindowMonitor(IntPtr window, IntPtr monitor, int xpos, int ypos, int width, int height, int refreshRate);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowAttrib")] internal static extern unsafe int glfwGetWindowAttrib(IntPtr window, int attrib);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowAttrib")] internal static extern unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowUserPointer")] internal static extern unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowUserPointer")] internal static extern unsafe void* glfwGetWindowUserPointer(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowPosCallback")] internal static extern unsafe GLFWwindowposfun glfwSetWindowPosCallback(IntPtr window, GLFWwindowposfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowSizeCallback")] internal static extern unsafe GLFWwindowsizefun glfwSetWindowSizeCallback(IntPtr window, GLFWwindowsizefun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowCloseCallback")] internal static extern unsafe GLFWwindowclosefun glfwSetWindowCloseCallback(IntPtr window, GLFWwindowclosefun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowRefreshCallback")] internal static extern unsafe GLFWwindowrefreshfun glfwSetWindowRefreshCallback(IntPtr window, GLFWwindowrefreshfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowFocusCallback")] internal static extern unsafe GLFWwindowfocusfun glfwSetWindowFocusCallback(IntPtr window, GLFWwindowfocusfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowIconifyCallback")] internal static extern unsafe GLFWwindowiconifyfun glfwSetWindowIconifyCallback(IntPtr window, GLFWwindowiconifyfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowMaximizeCallback")] internal static extern unsafe GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(IntPtr window, GLFWwindowmaximizefun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetFramebufferSizeCallback")] internal static extern unsafe FramebuffersizeHandler glfwSetFramebufferSizeCallback(IntPtr window, IntPtr callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowContentScaleCallback")] internal static extern unsafe GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(IntPtr window, GLFWwindowcontentscalefun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwPollEvents")] internal static extern unsafe void glfwPollEvents();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWaitEvents")] internal static extern unsafe void glfwWaitEvents();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWaitEventsTimeout")] internal static extern unsafe void glfwWaitEventsTimeout(double timeout);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwPostEmptyEvent")] internal static extern unsafe void glfwPostEmptyEvent();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetInputMode")] internal static extern unsafe int glfwGetInputMode(IntPtr window, int mode);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetInputMode")] internal static extern unsafe void glfwSetInputMode(IntPtr window, int mode, int value);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwRawMouseMotionSupported")] internal static extern unsafe int glfwRawMouseMotionSupported();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetKeyName")] internal static extern unsafe byte* glfwGetKeyName(int key, int scancode);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetKeyScancode")] internal static extern unsafe int glfwGetKeyScancode(int key);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetKey")] internal static extern unsafe KeyStatus glfwGetKey(IntPtr window, int key);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetMouseButton")] internal static extern unsafe int glfwGetMouseButton(IntPtr window, int button);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetCursorPos")] internal static extern unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorPos")] internal static extern unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwCreateCursor")] internal static extern unsafe GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwCreateStandardCursor")] internal static extern unsafe GLFWcursor* glfwCreateStandardCursor(int shape);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwDestroyCursor")] internal static extern unsafe void glfwDestroyCursor(GLFWcursor* cursor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursor")] internal static extern unsafe void glfwSetCursor(IntPtr window, GLFWcursor* cursor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetKeyCallback")] internal static extern unsafe GLFWkeyfun glfwSetKeyCallback(IntPtr window, GLFWkeyfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCharCallback")] internal static extern unsafe GLFWcharfun glfwSetCharCallback(IntPtr window, GLFWcharfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCharModsCallback")] internal static extern unsafe GLFWcharmodsfun glfwSetCharModsCallback(IntPtr window, GLFWcharmodsfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetMouseButtonCallback")] internal static extern unsafe GLFWmousebuttonfun glfwSetMouseButtonCallback(IntPtr window, GLFWmousebuttonfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorPosCallback")] internal static extern unsafe GLFWcursorposfun glfwSetCursorPosCallback(IntPtr window, GLFWcursorposfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursorEnterCallback")] internal static extern unsafe GLFWcursorenterfun glfwSetCursorEnterCallback(IntPtr window, GLFWcursorenterfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetScrollCallback")] internal static extern unsafe GLFWscrollfun glfwSetScrollCallback(IntPtr window, GLFWscrollfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetDropCallback")] internal static extern unsafe GLFWdropfun glfwSetDropCallback(IntPtr window, GLFWdropfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwJoystickPresent")] internal static extern unsafe int glfwJoystickPresent(int jid);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickAxes")] internal static extern unsafe float* glfwGetJoystickAxes(int jid, int* count);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickButtons")] internal static extern unsafe byte* glfwGetJoystickButtons(int jid, int* count);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickHats")] internal static extern unsafe byte* glfwGetJoystickHats(int jid, int* count);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickName")] internal static extern unsafe byte* glfwGetJoystickName(int jid);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickGUID")] internal static extern unsafe byte* glfwGetJoystickGUID(int jid);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetJoystickUserPointer")] internal static extern unsafe void glfwSetJoystickUserPointer(int jid, void* pointer);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetJoystickUserPointer")] internal static extern unsafe void* glfwGetJoystickUserPointer(int jid);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwJoystickIsGamepad")] internal static extern unsafe int glfwJoystickIsGamepad(int jid);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetJoystickCallback")] internal static extern unsafe GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwUpdateGamepadMappings")] internal static extern unsafe int glfwUpdateGamepadMappings(byte* str);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetGamepadName")] internal static extern unsafe byte* glfwGetGamepadName(int jid);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetGamepadState")] internal static extern unsafe int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetClipboardString")] internal static extern unsafe void glfwSetClipboardString(IntPtr window, byte* str);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetClipboardString")] internal static extern unsafe byte* glfwGetClipboardString(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetTime")] internal static extern unsafe double glfwGetTime();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetTime")] internal static extern unsafe void glfwSetTime(double time);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetTimerValue")] internal static extern unsafe ulong* glfwGetTimerValue();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetTimerFrequency")] internal static extern unsafe ulong* glfwGetTimerFrequency();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwMakeContextCurrent")] internal static extern unsafe void glfwMakeContextCurrent(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetCurrentContext")] internal static extern unsafe IntPtr glfwGetCurrentContext();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSwapBuffers")] internal static extern unsafe void glfwSwapBuffers(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSwapInterval")] internal static extern unsafe void glfwSwapInterval(int interval);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwExtensionSupported")] internal static extern unsafe int glfwExtensionSupported(byte* extension);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetProcAddress", CharSet = CharSet.Ansi)] internal static extern unsafe IntPtr glfwGetProcAddress(string procname);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwVulkanSupported")] internal static extern unsafe int glfwVulkanSupported();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetRequiredInstanceExtensions")] internal static extern unsafe byte** glfwGetRequiredInstanceExtensions(uint* count);
|
||||
|
||||
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwGetInstanceProcAddress")] internal extern unsafe static GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, byte* procname);
|
||||
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal extern unsafe static int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint* queuefamily);
|
||||
//[DllImport(InternalIO.SSC_libname, EntryPoint = "glfwCreateWindowSurface")] internal extern unsafe static VkResult glfwCreateWindowSurface(VkInstance instance, IntPtr window, VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#endregion api call
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,9 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
public static partial class glManager
|
||||
{
|
||||
const int glExtension = 0x1f03;
|
||||
const int glVersion = 0x1f02;
|
||||
private const int glExtension = 0x1f03;
|
||||
private const int glVersion = 0x1f02;
|
||||
|
||||
private static readonly string[] glBranch =
|
||||
new string[] {
|
||||
"OpenGL ES-CM ",
|
||||
@@ -22,19 +23,17 @@ namespace StgSharp.Graphics
|
||||
|
||||
private static string glExtensionList;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Load all aupportable OpenGL APIs and bind them to given <see cref="Form"/> context.
|
||||
/// </summary>
|
||||
/// <param name="form">The <see cref="Form"/> used as current OpenGL context</param>
|
||||
/// <param name="loader">A delegate that can get o</param>
|
||||
/// <param name="loader">A delegate to get address of OprnGL api</param>
|
||||
public static unsafe void LoadGLapi(this Form form, GLfuncLoader loader)
|
||||
{
|
||||
GLcontext* context = form.contextID;
|
||||
if (loader == null)
|
||||
{
|
||||
loader = LoadGLfunc;
|
||||
loader = InternalIO.glfwGetProcAddress;
|
||||
}
|
||||
#pragma warning disable CS8909
|
||||
if ((form.contextID->glGetString) != (delegate*<uint, IntPtr>)IntPtr.Zero)
|
||||
@@ -43,15 +42,14 @@ namespace StgSharp.Graphics
|
||||
return;
|
||||
}
|
||||
IntPtr proc = loader("glGetString");
|
||||
context->glGetString = (delegate*<uint, IntPtr>)proc;
|
||||
|
||||
if ((IntPtr)context->glGetString == IntPtr.Zero)
|
||||
if (proc == IntPtr.Zero)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine("Cannot load GL.");
|
||||
throw new Exception("Cannot load gl");
|
||||
#endif
|
||||
throw new Exception("Cannot load gl");
|
||||
}
|
||||
context->glGetString = (delegate*<uint, IntPtr>)proc;
|
||||
|
||||
string coreVersion;
|
||||
if (context->glGetString(glVersion) == IntPtr.Zero)
|
||||
@@ -60,7 +58,6 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
coreVersion = Marshal.PtrToStringAnsi(context->glGetString(glVersion));
|
||||
|
||||
|
||||
foreach (string branch in glBranch)
|
||||
{
|
||||
if (coreVersion.Contains(branch))
|
||||
@@ -97,7 +94,7 @@ namespace StgSharp.Graphics
|
||||
LoadGLcore45(form.contextID, loader);
|
||||
LoadGLcore46(form.contextID, loader);
|
||||
|
||||
#endregion
|
||||
#endregion load_core_gl
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -120,6 +117,7 @@ namespace StgSharp.Graphics
|
||||
extension.Split(" ").ToList();
|
||||
|
||||
#region checkGLextensions
|
||||
|
||||
if (extensions.Contains("gl_4DFX_multisample")) { _4DFX_multisample = true; extensions.Remove("gl_4DFX_multisample"); }
|
||||
if (extensions.Contains("gl_3DFX_tbuffer")) { _3DFX_tbuffer = true; extensions.Remove("gl_3DFX_tbuffer"); }
|
||||
if (extensions.Contains("gl_3DFX_texture_compression_FXT1")) { _3DFX_texture_compression_FXT1 = true; extensions.Remove("gl_3DFX_texture_compression_FXT1"); }
|
||||
@@ -739,7 +737,8 @@ namespace StgSharp.Graphics
|
||||
if (extensions.Contains("gl_SUN_vertex")) { SUN_vertex = true; extensions.Remove("glSUN_vertex"); }
|
||||
if (extensions.Contains("gl_WIN_phong_shading")) { WIN_phong_shading = true; extensions.Remove("glWIN_phong_shading"); }
|
||||
if (extensions.Contains("gl_WIN_specular_fog")) { WIN_specular_fog = true; extensions.Remove("glWIN_specular_fog"); }
|
||||
#endregion
|
||||
|
||||
#endregion checkGLextensions
|
||||
|
||||
InternalIO.InternalWriteLog("Find OpenGL extensions.", LogType.Info);
|
||||
|
||||
@@ -770,7 +769,6 @@ namespace StgSharp.Graphics
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
internal static void CheckCoreVersion(int majorVersion, int minorVersion)
|
||||
{
|
||||
if ((majorVersion >= 1) || (majorVersion == 1 && minorVersion == 0)) core10 = true; else goto log;
|
||||
@@ -798,10 +796,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalWriteLog("Find core OpenGL version.", LogType.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal unsafe static string GetExtensions(this GLcontext context)
|
||||
internal static unsafe string GetExtensions(this GLcontext context)
|
||||
{
|
||||
if (context.glGetString == null)
|
||||
{
|
||||
@@ -835,7 +832,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 1.0 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glBlendFunc = (delegate*<uint, uint, void>)load("glBlendFunc");
|
||||
contextPtr->glClear = (delegate*<uint, void>)load("glClear");
|
||||
contextPtr->glClearColor = (delegate*<float, float, float, float, void>)load("glClearColor");
|
||||
@@ -885,7 +884,8 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glTexParameteriv = (delegate*<uint, uint, int*, void>)load("glTexParameteriv");
|
||||
contextPtr->glViewport = (delegate*<int, int, uint, uint, void>)load("glViewport");
|
||||
|
||||
#endregion
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.0 APIs");
|
||||
}
|
||||
|
||||
@@ -896,7 +896,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 1.1 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glBindTexture = (delegate*<uint, uint, void>)load("glBindTexture");
|
||||
contextPtr->glCopyTexImage1D = (delegate*<uint, int, uint, int, int, uint, int, void>)load("glCopyTexImage1D");
|
||||
contextPtr->glCopyTexImage2D = (delegate*<uint, int, uint, int, int, uint, uint, int, void>)load("glCopyTexImage2D");
|
||||
@@ -912,9 +914,9 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glTexSubImage1D = (delegate*<uint, int, int, uint, uint, uint, void*, void>)load("glTexSubImage1D");
|
||||
contextPtr->glTexSubImage2D = (delegate*<uint, int, int, int, uint, uint, uint, uint, void*, void>)load("glTexSubImage2D");
|
||||
|
||||
#endregion
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.1 APIs");
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.1 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore12(GLcontext* contextPtr, GLfuncLoader load)
|
||||
@@ -924,25 +926,29 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 1.2 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glCopyTexSubImage3D = (delegate*<uint, int, int, int, int, int, int, uint, uint, void>)load("glCopyTexSubImage3D");
|
||||
contextPtr->glDrawRangeElements = (delegate*<uint, uint, uint, uint, uint, void*, void>)load("glDrawRangeElements");
|
||||
contextPtr->glTexImage3D = (delegate*<uint, int, int, uint, uint, uint, int, uint, uint, void*, void>)load("glTexImage3D");
|
||||
contextPtr->glTexSubImage3D = (delegate*<uint, int, int, int, int, uint, uint, uint, uint, uint, void*, void>)load("glTexSubImage3D");
|
||||
|
||||
#endregion
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.2 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore13(GLcontext* contextPtr, GLfuncLoader load)
|
||||
{
|
||||
|
||||
if (!core13)
|
||||
{
|
||||
InternalIO.InternalAppendLog("The core version 1.3 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glActiveTexture = (delegate*<uint, void>)load("glActiveTexture");
|
||||
contextPtr->glCompressedTexImage1D = (delegate*<uint, int, uint, uint, int, uint, void*, void>)load("glCompressedTexImage1D");
|
||||
contextPtr->glCompressedTexImage2D = (delegate*<uint, int, uint, uint, uint, int, uint, void*, void>)load("glCompressedTexImage2D");
|
||||
@@ -953,9 +959,9 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glGetCompressedTexImage = (delegate*<uint, int, void*, void>)load("glGetCompressedTexImage");
|
||||
contextPtr->glSampleCoverage = (delegate*<float, bool, void>)load("glSampleCoverage");
|
||||
|
||||
#endregion
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.3 APIs");
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.3 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore14(GLcontext* contextPtr, GLfuncLoader load)
|
||||
@@ -965,7 +971,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 1.4 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glBlendColor = (delegate*<float, float, float, float, void>)load("glBlendColor");
|
||||
contextPtr->glBlendEquation = (delegate*<uint, void>)load("glBlendEquation");
|
||||
contextPtr->glBlendFuncSeparate = (delegate*<uint, uint, uint, uint, void>)load("glBlendFuncSeparate");
|
||||
@@ -976,20 +984,21 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glPointParameteri = (delegate*<uint, int, void>)load("glPointParameteri");
|
||||
contextPtr->glPointParameteriv = (delegate*<uint, int*, void>)load("glPointParameteriv");
|
||||
|
||||
#endregion
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.4 APIs");
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.4 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore15(GLcontext* contextPtr, GLfuncLoader load)
|
||||
{
|
||||
|
||||
if (!core15)
|
||||
{
|
||||
InternalIO.InternalAppendLog("The core version 1.5 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glBeginQuery = (delegate*<uint, uint, void>)load("glBeginQuery");
|
||||
contextPtr->glBindBuffer = (delegate*<uint, uint, void>)load("glBindBuffer");
|
||||
contextPtr->glBufferData = (delegate*<uint, IntPtr, void*, uint, void>)load("glBufferData");
|
||||
@@ -1010,9 +1019,9 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glMapBuffer = (delegate*<uint, uint, void*>)load("glMapBuffer");
|
||||
contextPtr->glUnmapBuffer = (delegate*<uint, bool>)load("glUnmapBuffer");
|
||||
|
||||
#endregion
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.5 APIs");
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.5 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore20(GLcontext* contextPtr, GLfuncLoader load)
|
||||
@@ -1022,7 +1031,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 2.0 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glAttachShader = (delegate*<uint, uint, void>)load("glAttachShader");
|
||||
contextPtr->glBindAttribLocation = (delegate*<uint, uint, byte*, void>)load("glBindAttribLocation");
|
||||
contextPtr->glBlendEquationSeparate = (delegate*<uint, uint, void>)load("glBlendEquationSeparate");
|
||||
@@ -1117,9 +1128,9 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glVertexAttrib4usv = (delegate*<uint, ushort*, void>)load("glVertexAttrib4usv");
|
||||
contextPtr->glVertexAttribPointer = (delegate*<uint, int, uint, int, uint, void*, void>)load("glVertexAttribPointer");
|
||||
|
||||
#endregion
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 2.0 APIs");
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 2.0 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore21(GLcontext* contextPtr, GLfuncLoader load)
|
||||
@@ -1129,7 +1140,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 2.1 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glUniformMatrix2x3fv = (delegate*<int, uint, bool, float*, void>)load("glUniformMatrix2x3fv");
|
||||
contextPtr->glUniformMatrix2x4fv = (delegate*<int, uint, bool, float*, void>)load("glUniformMatrix2x4fv");
|
||||
contextPtr->glUniformMatrix3x2fv = (delegate*<int, uint, bool, float*, void>)load("glUniformMatrix3x2fv");
|
||||
@@ -1137,9 +1150,9 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glUniformMatrix4x2fv = (delegate*<int, uint, bool, float*, void>)load("glUniformMatrix4x2fv");
|
||||
contextPtr->glUniformMatrix4x3fv = (delegate*<int, uint, bool, float*, void>)load("glUniformMatrix4x3fv");
|
||||
|
||||
#endregion
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 2.1 APIs");
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 2.1 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore30(GLcontext* contextPtr, GLfuncLoader load)
|
||||
@@ -1149,7 +1162,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 3.0 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glBeginConditionalRender = (delegate*<uint, uint, void>)load("glBeginConditionalRender");
|
||||
contextPtr->glBeginTransformFeedback = (delegate*<uint, void>)load("glBeginTransformFeedback");
|
||||
contextPtr->glBindBufferBase = (delegate*<uint, uint, uint, void>)load("glBindBufferBase");
|
||||
@@ -1235,9 +1250,9 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glVertexAttribI4usv = (delegate*<uint, ushort*, void>)load("glVertexAttribI4usv");
|
||||
contextPtr->glVertexAttribIPointer = (delegate*<uint, int, uint, uint, void*, void>)load("glVertexAttribIPointer");
|
||||
|
||||
#endregion
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 3.0 APIs");
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 3.0 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore31(GLcontext* contextPtr, GLfuncLoader load)
|
||||
@@ -1247,7 +1262,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 3.1 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glBindBufferBase = (delegate*<uint, uint, uint, void>)load("glBindBufferBase");
|
||||
contextPtr->glBindBufferRange = (delegate*<uint, uint, uint, IntPtr, UIntPtr, void>)load("glBindBufferRange");
|
||||
contextPtr->glCopyBufferSubData = (delegate*<uint, uint, IntPtr, IntPtr, UIntPtr, void>)load("glCopyBufferSubData");
|
||||
@@ -1264,7 +1281,8 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glTexBuffer = (delegate*<uint, uint, uint, void>)load("glTexBuffer");
|
||||
contextPtr->glUniformBlockBinding = (delegate*<uint, uint, uint, void>)load("glUniformBlockBinding");
|
||||
|
||||
#endregion
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 3.1 APIs");
|
||||
}
|
||||
|
||||
@@ -1275,7 +1293,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 3.2 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glClientWaitSync = (delegate*<GLsync, uint, ulong, uint>)load("glClientWaitSync");
|
||||
contextPtr->glDeleteSync = (delegate*<GLsync, void>)load("glDeleteSync");
|
||||
contextPtr->glDrawElementsBaseVertex = (delegate*<uint, uint, uint, void*, int, void>)load("glDrawElementsBaseVertex");
|
||||
@@ -1296,9 +1316,9 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glTexImage3DMultisample = (delegate*<uint, uint, uint, uint, uint, uint, bool, void>)load("glTexImage3DMultisample");
|
||||
contextPtr->glWaitSync = (delegate*<GLsync, uint, ulong, void>)load("glWaitSync");
|
||||
|
||||
#endregion
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 3.2 APIs");
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 3.2 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore33(GLcontext* contextPtr, GLfuncLoader load)
|
||||
@@ -1308,7 +1328,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 3.3 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glBindFragDataLocationIndexed = (delegate*<uint, uint, uint, byte*, void>)load("glBindFragDataLocationIndexed");
|
||||
contextPtr->glBindSampler = (delegate*<uint, uint, void>)load("glBindSampler");
|
||||
contextPtr->glDeleteSamplers = (delegate*<uint, uint*, void>)load("glDeleteSamplers");
|
||||
@@ -1338,9 +1360,9 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glVertexAttribP4ui = (delegate*<uint, uint, bool, uint, void>)load("glVertexAttribP4ui");
|
||||
contextPtr->glVertexAttribP4uiv = (delegate*<uint, uint, bool, uint*, void>)load("glVertexAttribP4uiv");
|
||||
|
||||
#endregion
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 3.3 APIs");
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 3.3 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore40(GLcontext* contextPtr, GLfuncLoader load)
|
||||
@@ -1350,7 +1372,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 4.0 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glBeginQueryIndexed = (delegate*<uint, uint, uint, void>)load("glBeginQueryIndexed");
|
||||
contextPtr->glBindTransformFeedback = (delegate*<uint, uint, void>)load("glBindTransformFeedback");
|
||||
contextPtr->glBlendEquationSeparatei = (delegate*<uint, uint, uint, void>)load("glBlendEquationSeparatei");
|
||||
@@ -1398,7 +1422,8 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glUniformMatrix4x3dv = (delegate*<int, uint, bool, double*, void>)load("glUniformMatrix4x3dv");
|
||||
contextPtr->glUniformSubroutinesuiv = (delegate*<uint, uint, uint*, void>)load("glUniformSubroutinesuiv");
|
||||
|
||||
#endregion
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.0 APIs");
|
||||
}
|
||||
|
||||
@@ -1409,7 +1434,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 4.1 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glActiveShaderProgram = (delegate*<uint, uint, void>)load("glActiveShaderProgram");
|
||||
contextPtr->glBindProgramPipeline = (delegate*<uint, void>)load("glBindProgramPipeline");
|
||||
contextPtr->glClearDepthf = (delegate*<float, void>)load("glClearDepthf");
|
||||
@@ -1499,7 +1526,8 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glViewportIndexedf = (delegate*<uint, float, float, float, float, void>)load("glViewportIndexedf");
|
||||
contextPtr->glViewportIndexedfv = (delegate*<uint, float*, void>)load("glViewportIndexedfv");
|
||||
|
||||
#endregion
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.1 APIs");
|
||||
}
|
||||
|
||||
@@ -1510,7 +1538,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 4.2 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glBindImageTexture = (delegate*<uint, uint, int, bool, int, uint, uint, void>)load("glBindImageTexture");
|
||||
contextPtr->glDrawArraysInstancedBaseInstance = (delegate*<uint, int, uint, uint, uint, void>)load("glDrawArraysInstancedBaseInstance");
|
||||
contextPtr->glDrawElementsInstancedBaseInstance = (delegate*<uint, uint, uint, void*, uint, uint, void>)load("glDrawElementsInstancedBaseInstance");
|
||||
@@ -1524,7 +1554,8 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glTexStorage2D = (delegate*<uint, uint, uint, uint, uint, void>)load("glTexStorage2D");
|
||||
contextPtr->glTexStorage3D = (delegate*<uint, uint, uint, uint, uint, uint, void>)load("glTexStorage3D");
|
||||
|
||||
#endregion
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.2 APIs");
|
||||
}
|
||||
|
||||
@@ -1535,7 +1566,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 4.3 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glBindVertexBuffer = (delegate*<uint, uint, IntPtr, uint, void>)load("glBindVertexBuffer");
|
||||
contextPtr->glClearBufferData = (delegate*<uint, uint, uint, uint, void*, void>)load("glClearBufferData");
|
||||
contextPtr->glClearBufferSubData = (delegate*<uint, uint, IntPtr, UIntPtr, uint, uint, void*, void>)load("glClearBufferSubData");
|
||||
@@ -1581,7 +1614,8 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glClearBufferData = (delegate*<uint, uint, uint, uint, void*, void>)load("glClearBufferData");
|
||||
contextPtr->glVertexBindingDivisor = (delegate*<uint, uint, void>)load("glVertexBindingDivisor");
|
||||
|
||||
#endregion
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.3 APIs");
|
||||
}
|
||||
|
||||
@@ -1592,7 +1626,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 4.4 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glBindBuffersBase = (delegate*<uint, uint, uint, uint*, void>)load("glBindBuffersBase");
|
||||
contextPtr->glBindBuffersRange = (delegate*<uint, uint, uint, uint*, IntPtr*, UIntPtr*, void>)load("glBindBuffersRange");
|
||||
contextPtr->glBindImageTextures = (delegate*<uint, uint, uint*, void>)load("glBindImageTextures");
|
||||
@@ -1603,7 +1639,8 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glClearTexImage = (delegate*<uint, int, uint, uint, void*, void>)load("glClearTexImage");
|
||||
contextPtr->glClearTexSubImage = (delegate*<uint, int, int, int, int, uint, uint, uint, uint, uint, void*, void>)load("glClearTexSubImage");
|
||||
|
||||
#endregion
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.4 APIs");
|
||||
}
|
||||
|
||||
@@ -1614,7 +1651,9 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 4.5 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glBindTextureUnit = (delegate*<uint, uint, void>)load("glBindTextureUnit");
|
||||
contextPtr->glBlitNamedFramebuffer = (delegate*<uint, uint, int, int, int, int, int, int, int, int, uint, uint, void>)load("glBlitNamedFramebuffer");
|
||||
contextPtr->glCheckNamedFramebufferStatus = (delegate*<uint, uint, uint>)load("glCheckNamedFramebufferStatus");
|
||||
@@ -1726,7 +1765,8 @@ namespace StgSharp.Graphics
|
||||
contextPtr->glVertexArrayVertexBuffer = (delegate*<uint, uint, uint, IntPtr, uint, void>)load("glVertexArrayVertexBuffer");
|
||||
contextPtr->glVertexArrayVertexBuffers = (delegate*<uint, uint, uint, uint*, IntPtr*, uint*, void>)load("glVertexArrayVertexBuffers");
|
||||
|
||||
#endregion
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.5 APIs");
|
||||
}
|
||||
|
||||
@@ -1737,15 +1777,17 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalAppendLog("The core version 4.6 is not supported.");
|
||||
throw new Exception("Final Version");
|
||||
}
|
||||
|
||||
#region load
|
||||
|
||||
contextPtr->glMultiDrawArraysIndirectCount = (delegate*<uint, void*, IntPtr, uint, uint, void>)load("glMultiDrawArraysIndirectCount");
|
||||
contextPtr->glMultiDrawElementsIndirectCount = (delegate*<uint, uint, void*, IntPtr, uint, uint, void>)load("glMultiDrawElementsIndirectCount");
|
||||
contextPtr->glPolygonOffsetClamp = (delegate*<float, float, float, void>)load("glPolygonOffsetClamp");
|
||||
contextPtr->glSpecializeShader = (delegate*<uint, byte*, uint, uint*, uint*, void>)load("glSpecializeShader");
|
||||
|
||||
#endregion
|
||||
#endregion load
|
||||
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.6 APIs");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
public interface IglFunc
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Same function as OpenGL api glActiveTexture
|
||||
/// </summary>
|
||||
@@ -15,7 +14,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
/// <summary>
|
||||
/// Operation after alignment by calling <see cref="AlignFrame(Form)"/>.
|
||||
/// No calling of this method is acceptable, but it will bring the risk
|
||||
/// No calling of this method is acceptable, but it will bring the risk
|
||||
/// of that relevant code will not run if it is interrupted by frame overtime.
|
||||
/// Please call this method immediately after calling <see cref="AlignFrame(Form)"/>,
|
||||
/// too early or sonner may cause <see cref="InvalidOperationException"/>.
|
||||
@@ -74,7 +73,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
/// <summary>
|
||||
/// Call apiClearColor in OpenGL
|
||||
/// specifies the red, green, blue, and alpha values used by apiClear to clear the color buffers.
|
||||
/// specifies the red, green, blue, and alpha values used by apiClear to clear the color buffers.
|
||||
/// Values specified by apiClearColor are clamped to the range [0,1]
|
||||
/// </summary>
|
||||
/// <param name="R">Specify the red values used when the color buffers are cleared.</param>
|
||||
@@ -108,7 +107,7 @@ namespace StgSharp.Graphics
|
||||
glHandleSet CreateProgram(int count);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a form and its associated
|
||||
/// Creates a form and its associated
|
||||
/// </summary>
|
||||
/// <param name="width">Required width</param>
|
||||
/// <param name="height">Required width</param>
|
||||
@@ -139,7 +138,7 @@ namespace StgSharp.Graphics
|
||||
unsafe void DeleteVertexArrays(glHandleSet handleSet);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="mode"></param>
|
||||
/// <param name="count"></param>
|
||||
@@ -166,7 +165,6 @@ namespace StgSharp.Graphics
|
||||
/// <param name="count">Amount of vao to be generated</param>
|
||||
unsafe glHandleSet GenVertexArrays(int count);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Same fucntion as OpenGL api, glGetUniformLocation
|
||||
/// </summary>
|
||||
@@ -175,7 +173,6 @@ namespace StgSharp.Graphics
|
||||
/// <returns></returns>
|
||||
unsafe glSHandle GetUniformLocation(glHandle program, string name);
|
||||
|
||||
|
||||
bool GetWindowShouldClose(Form form);
|
||||
|
||||
/// <summary>
|
||||
@@ -272,7 +269,7 @@ namespace StgSharp.Graphics
|
||||
/// <param name="format">color channels of this image</param>
|
||||
/// <param name="type">how this image express each pixel</param>
|
||||
/// <param name="pixels">data array of pixels</param>
|
||||
unsafe void TextureImage2d<T>(int target, int level, uint internalformat, uint width, uint height, uint format, uint type, T[] pixels) where T : struct;
|
||||
unsafe void TextureImage2d<T>(int target, int level, uint internalformat, uint width, uint height, uint format, uint type, glHandle pixels) where T : struct;
|
||||
|
||||
/// <summary>
|
||||
/// Same fucntion as OpenGL api glTexParameteri
|
||||
@@ -289,7 +286,7 @@ namespace StgSharp.Graphics
|
||||
void UseProgram(glHandle program);
|
||||
|
||||
/// <summary>
|
||||
/// Same function as the OpenGL api, glViewPort
|
||||
/// Same function as the OpenGL api, glViewPort
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -20,46 +21,23 @@ namespace StgSharp.Graphics
|
||||
internal IntPtr pixelPtr;
|
||||
}
|
||||
|
||||
internal byte[] pixelArray;
|
||||
internal glHandle pixelArrayHandle;
|
||||
internal ImageInfo info;
|
||||
|
||||
public int Width { get => info.width; }
|
||||
public int Height { get => info.height; }
|
||||
public int Channel { get => info.channel; }
|
||||
|
||||
//TODO fix the bug
|
||||
internal Image(ImageInfo information)
|
||||
{
|
||||
info = information;
|
||||
int length = info.width * info.height * info.channel;
|
||||
pixelArray = new byte[length];
|
||||
Marshal.Copy(
|
||||
source: info.pixelPtr,
|
||||
destination: pixelArray,
|
||||
startIndex: 0,
|
||||
length: length
|
||||
);
|
||||
}
|
||||
|
||||
internal byte[] PixelArray
|
||||
{
|
||||
get
|
||||
{
|
||||
if (pixelArray == null)
|
||||
{
|
||||
pixelArray = new byte[info.width * info.height * info.channel];
|
||||
Marshal.Copy(source: info.pixelPtr, destination: pixelArray,
|
||||
startIndex: 0, length: info.width * info.height * info.channel);
|
||||
Marshal.FreeHGlobal(info.pixelPtr);
|
||||
}
|
||||
return pixelArray;
|
||||
}
|
||||
pixelArrayHandle = glHandle.Alloc(information.pixelPtr);
|
||||
}
|
||||
|
||||
public unsafe Image()
|
||||
{
|
||||
#if NET5_0_OR_GREATER
|
||||
Unsafe.SkipInit(out pixelArray);
|
||||
#endif
|
||||
info = new ImageInfo();
|
||||
}
|
||||
|
||||
@@ -67,8 +45,5 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
Marshal.FreeHGlobal(info.pixelPtr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using StgSharp.Graphics;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
@@ -24,7 +25,7 @@ namespace StgSharp
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The first memeber of this linkec list.
|
||||
/// The first memeber of this linkec list.
|
||||
/// Set value to this property will reset the first node.
|
||||
/// </summary>
|
||||
public T First
|
||||
@@ -32,14 +33,14 @@ namespace StgSharp
|
||||
get { return _hook._next._value; }
|
||||
/*
|
||||
* This setter is ued to reset the First node,
|
||||
* be careful when use this setter to avoid
|
||||
* be careful when use this setter to avoid
|
||||
* unexpected risk of this List lose all nodes.
|
||||
*/
|
||||
private set { _hook._next = default; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The last memeber of this linkec list.
|
||||
/// The last memeber of this linkec list.
|
||||
/// Set value to this property will reset the first node.
|
||||
/// </summary>
|
||||
public T Tail
|
||||
@@ -47,7 +48,7 @@ namespace StgSharp
|
||||
get { return _hook._previous._value; }
|
||||
/*
|
||||
* This setter is ued to reset the Last node,
|
||||
* be careful when use this setter to avoid
|
||||
* be careful when use this setter to avoid
|
||||
* unexpected risk of this List lose all nodes.
|
||||
*/
|
||||
private set { _hook._previous = default; }
|
||||
@@ -75,7 +76,6 @@ namespace StgSharp
|
||||
node.Previous = _hook.Previous;
|
||||
_hook._previous._next = node;
|
||||
_hook._previous = node;
|
||||
|
||||
}
|
||||
count++;
|
||||
}
|
||||
@@ -177,7 +177,6 @@ namespace StgSharp
|
||||
do
|
||||
{
|
||||
enumerator = enumerator._next;
|
||||
Console.WriteLine(enumerator.Value.ToString());
|
||||
} while (!enumerator.Value.Equals(value)
|
||||
|| enumerator == _hook);
|
||||
|
||||
@@ -188,13 +187,16 @@ namespace StgSharp
|
||||
|
||||
return enumerator;
|
||||
}
|
||||
|
||||
/**/
|
||||
|
||||
internal struct LinkedListEnumrator<T> : IEnumerator
|
||||
{
|
||||
private LinkedList<T> _target;
|
||||
private T _value;
|
||||
LinkedListNode<T> enumerator;
|
||||
private LinkedListNode<T> enumerator;
|
||||
private uint index = 0;
|
||||
|
||||
public LinkedListEnumrator(LinkedList<T> target)
|
||||
{
|
||||
_target = target;
|
||||
@@ -241,6 +243,7 @@ namespace StgSharp
|
||||
enumerator = _target._hook;
|
||||
}
|
||||
}
|
||||
|
||||
/**/
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
WNDCLASSA
|
||||
AdjustWindowRect
|
||||
ChoosePixelFormat
|
||||
CreateWindowEx
|
||||
DefWindowProc
|
||||
DescribePixelFormat
|
||||
DestroyWindow
|
||||
DispatchMessage
|
||||
FreeLibrary
|
||||
GetDC
|
||||
GetEnhMetaFilePixelFormat
|
||||
@@ -12,12 +14,16 @@ GetPixelFormat
|
||||
GetProcAddress
|
||||
LoadCursor
|
||||
LoadLibrary
|
||||
PeekMessage
|
||||
PostQuitMessage
|
||||
RegisterClass
|
||||
RegisterClassA
|
||||
ReleaseDC
|
||||
SetPixelFormat
|
||||
ShowWindow
|
||||
SwapBuffers
|
||||
TranslateMessage
|
||||
UpdateWindow
|
||||
wglGetProcAddress
|
||||
wglCreateContext
|
||||
wglCreateLayerContext
|
||||
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -39,6 +39,11 @@
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
@@ -71,7 +76,7 @@
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.200\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Nitlo\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.8.0</NuGetToolVersion>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.9.1</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\Nitlo\.nuget\packages\" />
|
||||
|
||||
@@ -441,6 +441,11 @@
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
@@ -473,7 +478,7 @@
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.200\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "SScQmL5WQ0AzrZMLauY1KTdFWwXiNxuI2NAO+HKzMT6yvbrrHCjXhkO2hF1YkSE8A1s0fckrWrToL0C9zq4zOw==",
|
||||
"dgSpecHash": "xsb1MbFQpqBCYdQPA/4envmaHoUkPHoEi0xOw2a3gr5s56AndbAygoRuWnsVcCeV230ECqLFF5UDU8zLmgv6Iw==",
|
||||
"success": true,
|
||||
"projectFilePath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\StgSharp\\StgSharp.csproj",
|
||||
"expectedPackageFiles": [
|
||||
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a2241a5a5816a9438c63e3ca3c69313e6f2e8f56")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
e8b19b35bca753348ef94df4faf984102d2e81946d465d23132400b7d6c8fb6d
|
||||
457b2788dd58b1c0006f9a671fa39abf8ac3de9589c64a4bb867c6c39b05c04c
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
58a5acf3308fca3681fb52b5a33573286589d74ed6bfbc0feef0b87bad84cd81
|
||||
0437f6196a65a1b8aa683720932b3cb8cb17e7d708c883c23def372b98154e31
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\Debug\netstandard2.1\StgSharp.deps.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\Debug\netstandard2.1\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\Debug\netstandard2.1\StgSharp.xml
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.csproj.AssemblyReference.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.GeneratedMSBuildEditorConfig.editorconfig
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.AssemblyInfoInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.AssemblyInfo.cs
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.csproj.CoreCompileInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.sourcelink.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\Debug\netstandard2.1\StgSharp.deps.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\Debug\netstandard2.1\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\Debug\netstandard2.1\StgSharp.xml
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\refint\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.xml
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/839156948261837c173ee878d930fc868fce223e/*"}}
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/a2241a5a5816a9438c63e3ca3c69313e6f2e8f56/*"}}
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a2241a5a5816a9438c63e3ca3c69313e6f2e8f56")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
c1862356ddd7e2959b23a52710009da43652ba23933b4b87c911fea2ba456025
|
||||
ba191eb9fce1fb0f8131b73fcfaca304b182373a9d3ce6f86252bb1130b3ec04
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
is_global = true
|
||||
build_property.CsWin32InputMetadataPaths = C:\Users\Nitlo\.nuget\packages\microsoft.windows.sdk.win32metadata\55.0.45-preview\Windows.Win32.winmd|C:\Users\Nitlo\.nuget\packages\microsoft.windows.wdk.win32metadata\0.9.9-experimental\Windows.Wdk.winmd
|
||||
build_property.CsWin32InputDocPaths = C:\Users\Nitlo\.nuget\packages\microsoft.windows.sdk.win32docs\0.1.42-alpha\apidocs.msgpack
|
||||
build_property.TargetFramework = netstandard2.1
|
||||
build_property.TargetPlatformMinVersion = 7.0
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user