daily update on 20240325 by nitload youmu
This commit is contained in:
@@ -46,33 +46,6 @@ namespace StgSharp.Graphics
|
||||
/// </summary>
|
||||
public abstract unsafe partial class Form
|
||||
{
|
||||
#region metadata
|
||||
internal LinkedList<Control> allControl;
|
||||
internal Vector4 backgroundColor;
|
||||
internal IglFunc gl;
|
||||
internal IntPtr graphicContextID;
|
||||
internal int height;
|
||||
internal IntPtr monitor;
|
||||
internal string name;
|
||||
internal Form sharedForm;
|
||||
internal int width;
|
||||
private GLFWwindow* windowID;
|
||||
|
||||
#endregion metadata
|
||||
|
||||
#region form time
|
||||
|
||||
private short fpsCount;
|
||||
internal TimeSpanProvider frameTimeProvider;
|
||||
internal TimeSpanProvider fpsCountProvider = new TimeSpanProvider(1.0, TimeSpanProvider.DefaultProvider);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region form thread setting
|
||||
private bool isSingleThread = true;
|
||||
private List<FrameAsyncTask> frameAsyncTaskList = new List<FrameAsyncTask>();
|
||||
#endregion form thread setting
|
||||
|
||||
protected Form()
|
||||
{
|
||||
@@ -127,7 +100,7 @@ namespace StgSharp.Graphics
|
||||
set => width = value;
|
||||
}
|
||||
|
||||
public unsafe IntPtr WindowID => (IntPtr)windowID;
|
||||
public unsafe IntPtr WindowID => windowID;
|
||||
|
||||
protected FrameBufferSizeHandler FrameBufferSizeCallback
|
||||
{
|
||||
@@ -138,7 +111,7 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
internal unsafe GLFWwindow* id => windowID;
|
||||
internal unsafe IntPtr id => windowID;
|
||||
|
||||
internal bool IsSingleThread => isSingleThread;
|
||||
|
||||
@@ -173,7 +146,7 @@ namespace StgSharp.Graphics
|
||||
byte[] tittleBytes = Encoding.UTF8.GetBytes(name);
|
||||
if (sharedForm == null)
|
||||
{
|
||||
windowPtr = InternalIO.glfwCreateWindow(width, height, tittleBytes, monitor, (GLFWwindow*)IntPtr.Zero);
|
||||
windowPtr = InternalIO.glfwCreateWindow(width, height, tittleBytes, monitor, IntPtr.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -185,7 +158,7 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
else
|
||||
{
|
||||
windowID = (GLFWwindow*)windowPtr;
|
||||
windowID = windowPtr;
|
||||
}
|
||||
|
||||
graphicContextID = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GLcontext)));
|
||||
@@ -271,6 +244,35 @@ namespace StgSharp.Graphics
|
||||
public void SetSizeLimit(int minWidth, int minHeight, int maxWidth, int maxHeight)
|
||||
{ InternalIO.glfwSetWindowSizeLimits(this.windowID, minWidth, minHeight, maxWidth, maxHeight); }
|
||||
|
||||
#region metadata
|
||||
internal LinkedList<Control> allControl;
|
||||
internal Vector4 backgroundColor;
|
||||
internal IglFunc gl;
|
||||
internal IntPtr graphicContextID;
|
||||
internal int height;
|
||||
internal IntPtr monitor;
|
||||
internal string name;
|
||||
internal Form sharedForm;
|
||||
internal int width;
|
||||
private IntPtr windowID;
|
||||
|
||||
#endregion metadata
|
||||
|
||||
#region form time
|
||||
|
||||
private short fpsCount;
|
||||
internal TimeSpanProvider frameTimeProvider;
|
||||
internal TimeSpanProvider fpsCountProvider = new TimeSpanProvider(1.0, TimeSpanProvider.DefaultProvider);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region form thread setting
|
||||
private bool isSingleThread = true;
|
||||
private List<FrameAsyncThread> frameAsyncTaskList = new List<FrameAsyncThread>();
|
||||
#endregion form thread setting
|
||||
|
||||
|
||||
#region form main
|
||||
|
||||
/// <summary>
|
||||
@@ -297,33 +299,42 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
else
|
||||
{
|
||||
GLonUpdate update = new GLonUpdate((GLcontext*)graphicContextID);
|
||||
FrameAsyncTask updateTask = new AsyncUpdateDataTask(this);
|
||||
FrameAsyncTask renderTask = new AsyncRenderFrameTask(this);
|
||||
frameAsyncTaskList.Add(renderTask);
|
||||
frameAsyncTaskList.Add(updateTask);
|
||||
GLonUpdate update = new GLonUpdate((GLcontext*)graphicContextID); //更换GL库至双线程模式
|
||||
FrameAsyncThread updateT = new AsyncUpdateDataTask(this); //建立两个异步线程
|
||||
FrameAsyncThread renderT = new AsyncRenderFrameTask(this);
|
||||
|
||||
frameAsyncTaskList.Add(renderT);
|
||||
frameAsyncTaskList.Add(updateT);
|
||||
gl = update;
|
||||
update.ActivatedOperationBuffer = updateTask.opBuffer;
|
||||
SemaphoreSlim frameBeginSemaphore = FrameAsyncTask.CombineAsync(renderTask, updateTask);
|
||||
SemaphoreSlim renderCompleteSemaphor = renderTask.StartAsync();
|
||||
SemaphoreSlim updateCompleteSemaphor = updateTask.StartAsync();
|
||||
|
||||
update.ActivatedOperationBuffer = updateT.opBuffer;
|
||||
SemaphoreSlim frameBeginSemaphore = FrameAsyncThread.CombineAsync(renderT, updateT);
|
||||
SemaphoreSlim renderCompleteSemaphor = renderT.AsyncStart();
|
||||
SemaphoreSlim updateCompleteSemaphor = updateT.AsyncStart();
|
||||
|
||||
while (!ShouldClose)
|
||||
{
|
||||
frameBeginSemaphore.Release(2);
|
||||
renderCompleteSemaphor.Wait();
|
||||
Console.WriteLine(1);
|
||||
frameBeginSemaphore.Release(2); //启动下一个渲染循环
|
||||
Console.WriteLine(2);
|
||||
renderCompleteSemaphor.Wait(); //等待两个线程完成
|
||||
updateCompleteSemaphor.Wait();
|
||||
SwapBuffers();
|
||||
Console.WriteLine(3);
|
||||
SwapBuffers(); //GLFW必要操作
|
||||
PollEvents();
|
||||
FrameAsyncTask.ExchangeBuffer(updateTask, renderTask);
|
||||
update.ActivatedOperationBuffer = updateTask.opBuffer;
|
||||
frameTimeProvider.WaitNextSpan();
|
||||
Console.WriteLine(4);
|
||||
FrameAsyncThread.ExchangeBuffer(updateT, renderT); //交换两个线程的缓冲区
|
||||
update.ActivatedOperationBuffer = updateT.opBuffer;
|
||||
Console.WriteLine(5);
|
||||
frameTimeProvider.WaitNextSpan(); //等待下一帧开始
|
||||
Console.WriteLine(6);
|
||||
}
|
||||
//TODO 对逻辑线程和渲染线程进行同步,两种gl模式包需要改名字
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int CurrentFrameCount
|
||||
=> frameTimeProvider.CurrentSpan;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal void InternalDeinit(params object[] args) { Deinit(args); }
|
||||
@@ -384,6 +395,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
|
||||
|
||||
#endregion form main
|
||||
#endregion form main
|
||||
|
||||
}
|
||||
}
|
||||
+59
-60
@@ -1,6 +1,6 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="FrameAsyncTask.cs"
|
||||
// file="FrameAsyncThread.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
@@ -88,7 +88,8 @@ namespace StgSharp.Graphics
|
||||
public void ParamEnqueue(M128 m)
|
||||
{
|
||||
paramQueue.Enqueue(m);
|
||||
Console.WriteLine(paramQueue.Count + streamQueue.Count);
|
||||
//Console.Write(paramQueue.Count + streamQueue.Count);
|
||||
//Console.Write($":{m.ToString(16)}\n");
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -224,14 +225,14 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
byte[] code = Encoding.UTF8.GetBytes(str);
|
||||
streamQueue.Enqueue(glArrayHandle.Alloc<byte>(code));
|
||||
Console.WriteLine(paramQueue.Count + streamQueue.Count);
|
||||
//Console.WriteLine(paramQueue.Count + streamQueue.Count);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void ParamEnqueue<T>(T[] array) where T : struct
|
||||
{
|
||||
streamQueue.Enqueue(glArrayHandle.Alloc<T>(array));
|
||||
Console.WriteLine(paramQueue.Count + streamQueue.Count);
|
||||
//Console.WriteLine(paramQueue.Count + streamQueue.Count);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -247,7 +248,9 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool TryDequeue(out M128 m)
|
||||
{
|
||||
m = new();
|
||||
bool ret = paramQueue.TryDequeue(out m);
|
||||
//Console.WriteLine(m.ToString(16));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -494,66 +497,32 @@ namespace StgSharp.Graphics
|
||||
//TODO 目前还不能加载任何任务
|
||||
//TODO 任务的启动逻辑需要重构
|
||||
|
||||
public class FrameAsyncTask
|
||||
public class FrameAsyncThread
|
||||
{
|
||||
|
||||
private Thread _task;
|
||||
|
||||
protected SemaphoreSlim _frameCompleteSemaphore = new SemaphoreSlim(0, 1);
|
||||
protected SemaphoreSlim _refreshSemaphore;
|
||||
private Task _task;
|
||||
protected Action _taskTODO;
|
||||
protected Func<bool> _terminateSignature;
|
||||
internal FrameOperationBuffer opBuffer;
|
||||
|
||||
internal FrameAsyncThread(Action action, IglFunc gl)
|
||||
{
|
||||
_taskTODO = action;
|
||||
opBuffer = new FrameOperationBuffer(gl);
|
||||
}
|
||||
|
||||
public Action TaskTODO
|
||||
{
|
||||
get => _taskTODO;
|
||||
set => _taskTODO = value;
|
||||
}
|
||||
|
||||
internal FrameAsyncTask(Action action, IglFunc gl)
|
||||
public virtual SemaphoreSlim AsyncStart()
|
||||
{
|
||||
_taskTODO = action;
|
||||
opBuffer = new FrameOperationBuffer(gl);
|
||||
}
|
||||
|
||||
public static SemaphoreSlim CombineAsync(params FrameAsyncTask[] taskList)
|
||||
{
|
||||
if (taskList.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
SemaphoreSlim refresh = new SemaphoreSlim(taskList.Length);
|
||||
foreach (FrameAsyncTask item in taskList)
|
||||
{
|
||||
item._refreshSemaphore = refresh;
|
||||
}
|
||||
return refresh;
|
||||
}
|
||||
|
||||
public static SemaphoreSlim CombineAsync(List<FrameAsyncTask> taskList)
|
||||
{
|
||||
if (taskList.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
SemaphoreSlim refresh = new SemaphoreSlim(taskList.Count);
|
||||
foreach (FrameAsyncTask item in taskList)
|
||||
{
|
||||
item._refreshSemaphore = refresh;
|
||||
}
|
||||
return refresh;
|
||||
}
|
||||
|
||||
public static void ExchangeBuffer(FrameAsyncTask task0, FrameAsyncTask task1)
|
||||
{
|
||||
FrameOperationBuffer cache = task0.opBuffer;
|
||||
task0.opBuffer = task1.opBuffer;
|
||||
task1.opBuffer = cache;
|
||||
}
|
||||
|
||||
public virtual SemaphoreSlim StartAsync()
|
||||
{
|
||||
_task = new Task(
|
||||
_task = new Thread(
|
||||
() =>
|
||||
{
|
||||
while (true)
|
||||
@@ -567,35 +536,65 @@ namespace StgSharp.Graphics
|
||||
return _frameCompleteSemaphore;
|
||||
}
|
||||
|
||||
public static SemaphoreSlim CombineAsync(params FrameAsyncThread[] taskList)
|
||||
{
|
||||
if (taskList.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
SemaphoreSlim refresh = new SemaphoreSlim(0, taskList.Length);
|
||||
foreach (FrameAsyncThread item in taskList)
|
||||
{
|
||||
item._refreshSemaphore = refresh;
|
||||
}
|
||||
return refresh;
|
||||
}
|
||||
|
||||
public static SemaphoreSlim CombineAsync(List<FrameAsyncThread> taskList)
|
||||
{
|
||||
if (taskList.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
SemaphoreSlim refresh = new SemaphoreSlim(taskList.Count);
|
||||
foreach (FrameAsyncThread item in taskList)
|
||||
{
|
||||
item._refreshSemaphore = refresh;
|
||||
}
|
||||
return refresh;
|
||||
}
|
||||
|
||||
public static void ExchangeBuffer(FrameAsyncThread task0, FrameAsyncThread task1)
|
||||
{
|
||||
FrameOperationBuffer cache = task0.opBuffer;
|
||||
task0.opBuffer = task1.opBuffer;
|
||||
task1.opBuffer = cache;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
internal sealed class AsyncUpdateDataTask : FrameAsyncTask
|
||||
internal sealed class AsyncUpdateDataTask : FrameAsyncThread
|
||||
{
|
||||
|
||||
public AsyncUpdateDataTask(Form f) : base(f.Main, f.GL)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal sealed class AsyncRenderFrameTask : FrameAsyncTask
|
||||
internal sealed class AsyncRenderFrameTask : FrameAsyncThread
|
||||
{
|
||||
|
||||
public AsyncRenderFrameTask(Form f) : base(null, f.gl)
|
||||
{
|
||||
TaskTODO = new (
|
||||
() =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
FrameOperation();
|
||||
}
|
||||
});
|
||||
TaskTODO = FrameOperation;
|
||||
}
|
||||
|
||||
private void FrameOperation()
|
||||
{
|
||||
while (opBuffer.CallNext()){}
|
||||
while (opBuffer.CallNext()) {}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,7 +43,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
protected glHandleSet _bufferHandle;
|
||||
protected IglFunc GL;
|
||||
protected Form binding;
|
||||
|
||||
/// <summary>
|
||||
/// Get the only handle to one of the Object instance
|
||||
|
||||
@@ -46,29 +46,29 @@ namespace StgSharp.Graphics
|
||||
public unsafe class ElementBuffer : BufferObjectBase
|
||||
{
|
||||
|
||||
internal ElementBuffer(int n, IglFunc gl)
|
||||
internal ElementBuffer(int n, Form binding)
|
||||
{
|
||||
GL = gl;
|
||||
_bufferHandle = GL.GenBuffers(n);
|
||||
this.binding = binding;
|
||||
_bufferHandle = binding.GL.GenBuffers(n);
|
||||
}
|
||||
|
||||
public override sealed void Bind(int index)
|
||||
{
|
||||
GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
}
|
||||
|
||||
public void SetValue<T>(int index, T[] bufferArray, BufferUsage usage)
|
||||
where T : struct, IConvertible
|
||||
{
|
||||
GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
GL.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
|
||||
binding.GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.GL.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
|
||||
}
|
||||
|
||||
protected override sealed void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
GL.DeleteBuffers(_bufferHandle);
|
||||
binding.GL.DeleteBuffers(_bufferHandle);
|
||||
_bufferHandle.Release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,28 +38,28 @@ namespace StgSharp.Graphics
|
||||
public unsafe class VertexArray : BufferObjectBase
|
||||
{
|
||||
|
||||
internal VertexArray(int n, IglFunc gl)
|
||||
internal VertexArray(int n, Form binding)
|
||||
{
|
||||
GL = gl;
|
||||
_bufferHandle = GL.GenVertexArrays(n);
|
||||
this.binding = binding;
|
||||
_bufferHandle = binding.GL.GenVertexArrays(n);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public override sealed void Bind(int index)
|
||||
{
|
||||
GL.BindVertexArray(_bufferHandle[index]);
|
||||
binding.GL.BindVertexArray(_bufferHandle[index]);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void BindNull()
|
||||
{
|
||||
GL.BindVertexArray(glHandle.Zero);
|
||||
binding.GL.BindVertexArray(glHandle.Zero);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetVertexAttribute(uint index, int vertexLength, TypeCode dataType, bool isNomalized, uint stride, int pointer)
|
||||
{
|
||||
GL.SetVertexAttribute(
|
||||
binding.GL.SetVertexAttribute(
|
||||
index, vertexLength, dataType,
|
||||
isNomalized,
|
||||
stride, pointer);
|
||||
@@ -69,7 +69,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
GL.DeleteVertexArrays(_bufferHandle);
|
||||
binding.GL.DeleteVertexArrays(_bufferHandle);
|
||||
_bufferHandle.Release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,15 +43,15 @@ namespace StgSharp.Graphics
|
||||
public unsafe class VertexBuffer : BufferObjectBase
|
||||
{
|
||||
|
||||
internal VertexBuffer(int n, IglFunc glFunc)
|
||||
internal VertexBuffer(int n, Form binding)
|
||||
{
|
||||
GL = glFunc;
|
||||
_bufferHandle = GL.GenBuffers(n);
|
||||
this.binding = binding;
|
||||
_bufferHandle = binding.GL.GenBuffers(n);
|
||||
}
|
||||
|
||||
public override sealed void Bind(int index)
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -63,8 +63,8 @@ namespace StgSharp.Graphics
|
||||
/// <param name="usage">How OpenGL use these data, defined by <see cref="BufferUsage"/></param>
|
||||
public void SetValue<T>(int index, T bufferData, BufferUsage usage) where T : struct, IMat
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferData, usage);
|
||||
binding.GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferData, usage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -76,8 +76,8 @@ namespace StgSharp.Graphics
|
||||
/// <param name="usage">How OpenGL use these data, defined by <see cref="BufferUsage"/></param>
|
||||
public void SetValueArray<T>(int index, T[] bufferArray, BufferUsage usage) where T : struct, IConvertible
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferArray, usage);
|
||||
binding.GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferArray, usage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -86,20 +86,16 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Unbind()
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, glHandle.Zero);
|
||||
binding.GL.BindBuffer(BufferType.ARRAY_BUFFER, glHandle.Zero);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal void ChangeEnvironment(IglFunc gl)
|
||||
{
|
||||
GL = gl;
|
||||
}
|
||||
|
||||
|
||||
protected override sealed void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
GL.DeleteBuffers(_bufferHandle);
|
||||
binding.GL.DeleteBuffers(_bufferHandle);
|
||||
_bufferHandle.Release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,25 +44,25 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
internal static bool[] unitActivated = new bool[16];
|
||||
private IglFunc GL;
|
||||
private Form binding;
|
||||
internal glHandleSet _textureHandle;
|
||||
internal Image[] sourceList;
|
||||
|
||||
internal Texture(int n, IglFunc gl)
|
||||
internal Texture(int n, Form binding)
|
||||
{
|
||||
sourceList = new Image[n];
|
||||
GL = gl;
|
||||
_textureHandle = GL.GenTextures(n);
|
||||
this.binding = binding;
|
||||
_textureHandle = binding.GL.GenTextures(n);
|
||||
}
|
||||
|
||||
public void Activate(TextureUnit unit)
|
||||
{
|
||||
GL.ActiveTexture((uint)unit);
|
||||
binding.GL.ActiveTexture((uint)unit);
|
||||
}
|
||||
|
||||
public void Bind2D(int index)
|
||||
{
|
||||
GL.BindTexture(GLconst.TEXTURE_2D, _textureHandle[index]);
|
||||
binding.GL.BindTexture(GLconst.TEXTURE_2D, _textureHandle[index]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -92,7 +92,7 @@ namespace StgSharp.Graphics
|
||||
channel = 0;
|
||||
break;
|
||||
}
|
||||
GL.TextureImage2d<byte>(
|
||||
binding.GL.TextureImage2d<byte>(
|
||||
GLconst.TEXTURE_2D, 0, channel,
|
||||
(uint)sourceList[index].Width, (uint)sourceList[index].Height,
|
||||
channel, GLconst.UNSIGNED_BYTE,
|
||||
@@ -105,25 +105,21 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
internal void ChangeEnvironment(IglFunc gl)
|
||||
{
|
||||
GL = gl;
|
||||
}
|
||||
|
||||
#region texture setting
|
||||
|
||||
public void Set2dFilterProperty(
|
||||
Filter onMinify, Filter onMagnify)
|
||||
{
|
||||
GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_MIN_FILTER, (int)onMinify);
|
||||
GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_MAG_FILTER, (int)onMagnify);
|
||||
binding.GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_MIN_FILTER, (int)onMinify);
|
||||
binding.GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_MAG_FILTER, (int)onMagnify);
|
||||
}
|
||||
|
||||
public void Set2dWrapProperty(
|
||||
Wrap onHorizontial, Wrap onVertical)
|
||||
{
|
||||
GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_WRAP_S, (int)onHorizontial);
|
||||
GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_WRAP_T, (int)onVertical);
|
||||
binding.GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_WRAP_S, (int)onHorizontial);
|
||||
binding.GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_WRAP_T, (int)onVertical);
|
||||
}
|
||||
|
||||
#endregion texture setting
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace StgSharp.Graphics
|
||||
if (share == null)
|
||||
{
|
||||
windowPtr = InternalIO.glfwCreateWindow(
|
||||
width, height, tittleBytes, monitor, (GLFWwindow*)IntPtr.Zero);
|
||||
width, height, tittleBytes, monitor, IntPtr.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -299,11 +299,12 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.SetBufferData<T>(BufferType bufferType, T bufferData, BufferUsage usage)
|
||||
{
|
||||
int size = sizeof(T);
|
||||
int size = Marshal.SizeOf<T>();
|
||||
T* p = &bufferData;
|
||||
api->glBufferData(
|
||||
(uint)bufferType,
|
||||
(IntPtr)size,
|
||||
(IntPtr)(&bufferData),
|
||||
(IntPtr)p,
|
||||
(uint)usage);
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace StgSharp.Graphics
|
||||
if (share == null)
|
||||
{
|
||||
windowPtr = InternalIO.glfwCreateWindow(
|
||||
width, height, tittleBytes, monitor, (GLFWwindow*)IntPtr.Zero);
|
||||
width, height, tittleBytes, monitor, IntPtr.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected ElementBuffer CreateElementBuffer(int count)
|
||||
{
|
||||
return new ElementBuffer(count, this.gl);
|
||||
return new ElementBuffer(count, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -59,7 +59,7 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected Texture CreateTexture(int count)
|
||||
{
|
||||
return new Texture(count, this.GL);
|
||||
return new Texture(count, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -70,7 +70,7 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected VertexArray CreateVertexArray(int count)
|
||||
{
|
||||
return new VertexArray(count, gl);
|
||||
return new VertexArray(count, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -81,7 +81,7 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected VertexBuffer CreateVertexBuffer(int count)
|
||||
{
|
||||
return new VertexBuffer(count, gl);
|
||||
return new VertexBuffer(count, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected ShaderProgram CreateShaderProgram()
|
||||
{
|
||||
return new ShaderProgram(GL);
|
||||
return new ShaderProgram(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -105,16 +105,16 @@ namespace StgSharp.Graphics
|
||||
public class ShaderProgram
|
||||
{
|
||||
|
||||
private readonly IglFunc GL;
|
||||
private readonly Form binding;
|
||||
internal readonly glHandle handle;
|
||||
|
||||
/// <summary>
|
||||
/// Inti a shader with no program attached.
|
||||
/// </summary>
|
||||
internal unsafe ShaderProgram(IglFunc gl)
|
||||
internal unsafe ShaderProgram(Form binding)
|
||||
{
|
||||
GL = gl;
|
||||
handle = GL.CreateProgram();
|
||||
this.binding = binding;
|
||||
handle = binding.GL.CreateProgram();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -126,7 +126,7 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe Uniform<T> GetUniform<T>(string name) where T : struct
|
||||
{
|
||||
return new Uniform<T>(this, name, GL);
|
||||
return new Uniform<T>(this, name, binding);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -139,7 +139,7 @@ namespace StgSharp.Graphics
|
||||
where T : struct
|
||||
where U : struct
|
||||
{
|
||||
return new Uniform<T, U>(this, name, GL);
|
||||
return new Uniform<T, U>(this, name, binding);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -153,7 +153,7 @@ namespace StgSharp.Graphics
|
||||
where U : struct
|
||||
where V : struct
|
||||
{
|
||||
return new Uniform<T, U, V>(this, name, GL);
|
||||
return new Uniform<T, U, V>(this, name, binding);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -161,7 +161,7 @@ namespace StgSharp.Graphics
|
||||
/// </summary>
|
||||
public unsafe void Link()
|
||||
{
|
||||
if (InternalIO.InternalLinkShaderProgram(GL.Context, handle.Value) == 0)
|
||||
if (InternalIO.InternalLinkShaderProgram(binding.GL.Context, handle.Value) == 0)
|
||||
{
|
||||
IntPtr logPtr = InternalIO.InternalReadSSCLog();
|
||||
try
|
||||
@@ -185,7 +185,7 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void Use()
|
||||
{
|
||||
GL.UseProgram(handle);
|
||||
binding.GL.UseProgram(handle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace StgSharp.Graphics
|
||||
public class Uniform<T> where T : struct
|
||||
{
|
||||
|
||||
private IglFunc GL;
|
||||
private Form binding;
|
||||
internal glSHandle id;
|
||||
|
||||
internal unsafe Uniform(glSHandle id)
|
||||
@@ -51,10 +51,10 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
internal unsafe Uniform(
|
||||
ShaderProgram program, string name, IglFunc gl)
|
||||
ShaderProgram program, string name, Form binding)
|
||||
{
|
||||
GL = gl;
|
||||
id = GL.GetUniformLocation(program.handle, name);
|
||||
this.binding = binding;
|
||||
id = binding.GL.GetUniformLocation(program.handle, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,7 +64,7 @@ namespace StgSharp.Graphics
|
||||
where U : struct
|
||||
{
|
||||
|
||||
private IglFunc GL;
|
||||
private Form binding;
|
||||
internal glSHandle id;
|
||||
|
||||
internal unsafe Uniform(glSHandle id)
|
||||
@@ -73,10 +73,10 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
internal unsafe Uniform(
|
||||
ShaderProgram program, string name, IglFunc gl)
|
||||
ShaderProgram program, string name, Form binding)
|
||||
{
|
||||
GL = gl;
|
||||
id = GL.GetUniformLocation(program.handle, name);
|
||||
this.binding = binding;
|
||||
id = binding.GL.GetUniformLocation(program.handle, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -87,7 +87,7 @@ namespace StgSharp.Graphics
|
||||
where V : struct
|
||||
{
|
||||
|
||||
private IglFunc GL;
|
||||
private Form binding;
|
||||
internal glSHandle id;
|
||||
|
||||
internal unsafe Uniform(glSHandle id)
|
||||
@@ -95,10 +95,10 @@ namespace StgSharp.Graphics
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public unsafe Uniform(ShaderProgram program, string name, IglFunc gl)
|
||||
public unsafe Uniform(ShaderProgram program, string name, Form binding)
|
||||
{
|
||||
GL = gl;
|
||||
id = GL.GetUniformLocation(program.handle, name);
|
||||
this.binding = binding;
|
||||
id = binding.GL.GetUniformLocation(program.handle, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -110,7 +110,7 @@ namespace StgSharp.Graphics
|
||||
where W : struct
|
||||
{
|
||||
|
||||
private IglFunc GL;
|
||||
private Form binding;
|
||||
internal glSHandle id;
|
||||
|
||||
internal unsafe Uniform(glSHandle id)
|
||||
@@ -118,10 +118,10 @@ namespace StgSharp.Graphics
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
internal unsafe Uniform(ShaderProgram program, string name, IglFunc gl)
|
||||
internal unsafe Uniform(ShaderProgram program, string name, Form binding)
|
||||
{
|
||||
GL = gl;
|
||||
id = GL.GetUniformLocation(program.handle, name);
|
||||
this.binding = binding;
|
||||
id = binding.GL.GetUniformLocation(program.handle, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -281,8 +281,8 @@ namespace StgSharp.Graphics
|
||||
|
||||
unsafe void IglFunc.SetValue(Uniform<Vec4d> uniform, Vec4d vec)
|
||||
{
|
||||
Vec4d m = vec;
|
||||
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr, (IntPtr)(&m));
|
||||
frameOpBuffer.ParamEnqueue((IntPtr)uniform.id.valuePtr);
|
||||
frameOpBuffer.ParamEnqueue(vec);
|
||||
frameOpBuffer.MethodEnqueue(UniformVal1fvPtr);
|
||||
}
|
||||
|
||||
|
||||
@@ -97,83 +97,83 @@ namespace StgSharp
|
||||
|
||||
[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, GLFWwindow* share);
|
||||
[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(GLFWwindow* window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwDestroyWindow")] internal static extern unsafe void glfwDestroyWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwWindowShouldClose")] internal static extern unsafe int glfwWindowShouldClose(GLFWwindow* 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(GLFWwindow* window, int value);
|
||||
[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(GLFWwindow* window, byte* title);
|
||||
[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(GLFWwindow* window, int count, GLFWimage* images);
|
||||
[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(GLFWwindow* window, int* xpos, int* ypos);
|
||||
[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(GLFWwindow* 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(GLFWwindow* window, int* width, int* height);
|
||||
[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(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
|
||||
[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(GLFWwindow* window, int numer, int denom);
|
||||
[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(GLFWwindow* window, int width, int height);
|
||||
[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(GLFWwindow* 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(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
|
||||
[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(GLFWwindow* window, float* xscale, float* yscale);
|
||||
[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(GLFWwindow* window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowOpacity")] internal static extern unsafe float glfwGetWindowOpacity(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowOpacity")] internal static extern unsafe void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
|
||||
[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(GLFWwindow* window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwIconifyWindow")] internal static extern unsafe void glfwIconifyWindow(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwRestoreWindow")] internal static extern unsafe void glfwRestoreWindow(GLFWwindow* 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(GLFWwindow* 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(GLFWwindow* 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(GLFWwindow* 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(GLFWwindow* 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(GLFWwindow* 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(GLFWwindow* 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(GLFWwindow* window, IntPtr monitor, int xpos, int ypos, int width, int height, int refreshRate);
|
||||
[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(GLFWwindow* window, int attrib);
|
||||
[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(GLFWwindow* window, int attrib, int value);
|
||||
[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(GLFWwindow* window, void* pointer);
|
||||
[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(GLFWwindow* window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetWindowUserPointer")] internal static extern unsafe void* glfwGetWindowUserPointer(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetWindowPosCallback")] internal static extern unsafe GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun callback);
|
||||
[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(GLFWwindow* window, GLFWwindowsizefun 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(GLFWwindow* window, GLFWwindowclosefun 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(GLFWwindow* window, GLFWwindowrefreshfun 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(GLFWwindow* window, GLFWwindowfocusfun 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(GLFWwindow* window, GLFWwindowiconifyfun 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(GLFWwindow* window, GLFWwindowmaximizefun 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(GLFWwindow* window, IntPtr 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(GLFWwindow* window, GLFWwindowcontentscalefun 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();
|
||||
|
||||
@@ -183,9 +183,9 @@ namespace StgSharp
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwPostEmptyEvent")] internal static extern unsafe void glfwPostEmptyEvent();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetInputMode")] internal static extern unsafe int glfwGetInputMode(GLFWwindow* window, int mode);
|
||||
[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(GLFWwindow* window, int mode, int value);
|
||||
[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();
|
||||
|
||||
@@ -193,13 +193,13 @@ namespace StgSharp
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetKeyScancode")] internal static extern unsafe int glfwGetKeyScancode(int key);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetKey")] internal static extern unsafe KeyStatus glfwGetKey(GLFWwindow* window, 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(GLFWwindow* window, int button);
|
||||
[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(GLFWwindow* window, double* xpos, double* ypos);
|
||||
[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(GLFWwindow* 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);
|
||||
|
||||
@@ -207,23 +207,23 @@ namespace StgSharp
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwDestroyCursor")] internal static extern unsafe void glfwDestroyCursor(GLFWcursor* cursor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetCursor")] internal static extern unsafe void glfwSetCursor(GLFWwindow* window, 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(GLFWwindow* window, GLFWkeyfun callback);
|
||||
[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(GLFWwindow* window, GLFWcharfun 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(GLFWwindow* window, GLFWcharmodsfun 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(GLFWwindow* window, GLFWmousebuttonfun 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(GLFWwindow* window, GLFWcursorposfun 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(GLFWwindow* window, GLFWcursorenterfun 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(GLFWwindow* window, GLFWscrollfun 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(GLFWwindow* window, GLFWdropfun 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);
|
||||
|
||||
@@ -251,9 +251,9 @@ namespace StgSharp
|
||||
|
||||
[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(GLFWwindow* window, byte* str);
|
||||
[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(GLFWwindow* window);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetClipboardString")] internal static extern unsafe byte* glfwGetClipboardString(IntPtr window);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetTime")] internal static extern unsafe double glfwGetTime();
|
||||
|
||||
@@ -263,11 +263,11 @@ namespace StgSharp
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetTimerFrequency")] internal static extern unsafe ulong* glfwGetTimerFrequency();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwMakeContextCurrent")] internal static extern unsafe void glfwMakeContextCurrent(GLFWwindow* window);
|
||||
[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(GLFWwindow* window);
|
||||
[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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user