daily update on 20240828 by nitload youmu, autotexture added
This commit is contained in:
@@ -57,6 +57,25 @@ namespace StgSharp.Graphics.OpenGL
|
||||
|
||||
private static string glExtensionList;
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Get the function pointer of given OpenGL api name
|
||||
/// </summary>
|
||||
/// <param name="name">ContextName of the OpenGL api</param>
|
||||
/// <returns>The funtion pointer of the api in stream of <see cref="IntPtr"/></returns>
|
||||
public static IntPtr LoadGLfunc(string name)
|
||||
{
|
||||
IntPtr ret = InternalIO.glfwGetProcAddress(name);
|
||||
if (ret == default)
|
||||
{
|
||||
InternalIO.InternalAppendLog(
|
||||
$"Cannot load OpenGL api called {name}, this api may not exist or supported.");
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load all supported OpenGL APIs and bind them to given <see cref="ViewPort"/>.
|
||||
/// </summary>
|
||||
@@ -64,7 +83,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
public static unsafe void LoadOpenGLApiTo(IntPtr contextHandle)
|
||||
{
|
||||
OpenglContext* context = (OpenglContext*)contextHandle;
|
||||
delegate*<string,IntPtr> loader = &InternalIO.glfwGetProcAddress;
|
||||
delegate*<string, IntPtr> loader = &InternalIO.glfwGetProcAddress;
|
||||
if ((IntPtr)context->glGetString != IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
@@ -84,7 +103,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
{
|
||||
InternalIO.InternalWriteLog("Failed to call glGetString", LogType.Error);
|
||||
}
|
||||
coreVersion = Marshal.PtrToStringAnsi(context->glGetString(glVersion))??string.Empty;
|
||||
coreVersion = Marshal.PtrToStringAnsi(context->glGetString(glVersion)) ?? string.Empty;
|
||||
|
||||
foreach (string branch in glBranch)
|
||||
{
|
||||
@@ -140,7 +159,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
int extensionCount;
|
||||
context->glGetIntegerv(GLconst.NUM_EXTENSIONS,&extensionCount);
|
||||
context->glGetIntegerv(GLconst.NUM_EXTENSIONS, &extensionCount);
|
||||
if (extensionCount == 0)
|
||||
{
|
||||
InternalIO.InternalWriteLog("No supported OpenGL extensions are found.", LogType.Info);
|
||||
@@ -151,12 +170,11 @@ namespace StgSharp.Graphics.OpenGL
|
||||
|
||||
for (uint i = 0; i < extensionCount; i++)
|
||||
{
|
||||
byte* strPtr = context->glGetStringi(GLconst.EXTENSIONS,i);
|
||||
byte* strPtr = context->glGetStringi(GLconst.EXTENSIONS, i);
|
||||
extensions.Add(Marshal.PtrToStringAnsi((IntPtr)strPtr));
|
||||
}
|
||||
|
||||
InternalIO.InternalWriteLog($"Find OpenGL extensions:" + Environment.NewLine +
|
||||
$"{string.Join(';', extensions)}",
|
||||
InternalIO.InternalWriteLog($"{$"Find OpenGL extensions:"}{Environment.NewLine}{($"{string.Join(';', extensions)}")}",
|
||||
LogType.Info);
|
||||
|
||||
#region checkGLextensions
|
||||
@@ -786,25 +804,6 @@ namespace StgSharp.Graphics.OpenGL
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Get the function pointer of given OpenGL api name
|
||||
/// </summary>
|
||||
/// <param name="name">ContextName of the OpenGL api</param>
|
||||
/// <returns>The funtion pointer of the api in stream of <see cref="IntPtr"/></returns>
|
||||
public static IntPtr LoadGLfunc(string name)
|
||||
{
|
||||
IntPtr ret = InternalIO.glfwGetProcAddress(name);
|
||||
if (ret == default)
|
||||
{
|
||||
InternalIO.InternalAppendLog(
|
||||
$"Cannot load OpenGL api called {name}, this api may not exist or supported.");
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
internal static void CheckCoreVersion(int majorVersion, int minorVersion)
|
||||
{
|
||||
if (majorVersion < 3)
|
||||
@@ -1017,7 +1016,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore10(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore10(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core10)
|
||||
{
|
||||
@@ -1081,7 +1080,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.0 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore11(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore11(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core11)
|
||||
{
|
||||
@@ -1111,7 +1110,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.1 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore12(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore12(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core12)
|
||||
{
|
||||
@@ -1131,7 +1130,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.2 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore13(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore13(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core13)
|
||||
{
|
||||
@@ -1156,7 +1155,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.3 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore14(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore14(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core14)
|
||||
{
|
||||
@@ -1181,7 +1180,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.4 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore15(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore15(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core15)
|
||||
{
|
||||
@@ -1216,7 +1215,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 1.5 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore20(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore20(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core20)
|
||||
{
|
||||
@@ -1325,7 +1324,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 2.0 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore21(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore21(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core21)
|
||||
{
|
||||
@@ -1347,7 +1346,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 2.1 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore30(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore30(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core30)
|
||||
{
|
||||
@@ -1447,7 +1446,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 3.0 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore31(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore31(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core31)
|
||||
{
|
||||
@@ -1478,7 +1477,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 3.1 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore32(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore32(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core32)
|
||||
{
|
||||
@@ -1513,7 +1512,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 3.2 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore33(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore33(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core33)
|
||||
{
|
||||
@@ -1557,7 +1556,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 3.3 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore40(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore40(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core40)
|
||||
{
|
||||
@@ -1619,7 +1618,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.0 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore41(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore41(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core41)
|
||||
{
|
||||
@@ -1723,7 +1722,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.1 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore42(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore42(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core42)
|
||||
{
|
||||
@@ -1751,7 +1750,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.2 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore43(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore43(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core43)
|
||||
{
|
||||
@@ -1811,7 +1810,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.3 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore44(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore44(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core44)
|
||||
{
|
||||
@@ -1836,7 +1835,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.4 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore45(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore45(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core45)
|
||||
{
|
||||
@@ -1962,7 +1961,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
InternalIO.InternalAppendLog("Successfully load all OpenGL 4.5 APIs");
|
||||
}
|
||||
|
||||
internal static unsafe void LoadGLcore46(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
internal static unsafe void LoadGLcore46(OpenglContext* contextPtr, delegate*<string, IntPtr> load)
|
||||
{
|
||||
if (!core46)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user