Add missing stuff.
This commit is contained in:
parent
72d0f02440
commit
1297365b38
@ -72,7 +72,7 @@ namespace Quik.OpenGL
|
|||||||
_vertexAttribPointer(location, size, type, normalized, stride, (IntPtr)offset);
|
_vertexAttribPointer(location, size, type, normalized, stride, (IntPtr)offset);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void VertexAttibIPointer(int location, int size, GLEnum type, int stride, int offset) =>
|
public static void VertexAttribIPointer(int location, int size, GLEnum type, int stride, int offset) =>
|
||||||
_vertexAttribIPointer(location, size, type, stride, (IntPtr)offset);
|
_vertexAttribIPointer(location, size, type, stride, (IntPtr)offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,8 +17,12 @@ namespace Quik.OpenGL
|
|||||||
private delegate void GLF4Proc(float x, float y, float z, float w);
|
private delegate void GLF4Proc(float x, float y, float z, float w);
|
||||||
private delegate void DrawElementsProc(GLEnum primitive, int size, GLEnum type, void *offset);
|
private delegate void DrawElementsProc(GLEnum primitive, int size, GLEnum type, void *offset);
|
||||||
private delegate void DrawArraysProc(GLEnum primitive, int size, void *offset);
|
private delegate void DrawArraysProc(GLEnum primitive, int size, void *offset);
|
||||||
|
private delegate void GetIntegervProc(GLEnum pname, int *data);
|
||||||
|
private delegate void GetFloatvProc(GLEnum pname, float *data);
|
||||||
|
private delegate byte* GetStringProc(GLEnum pname);
|
||||||
|
|
||||||
private const short AggressiveInlining = (short)MethodImplOptions.AggressiveInlining;
|
private const short AggressiveInlining = (short)MethodImplOptions.AggressiveInlining;
|
||||||
|
|
||||||
private static GetProcAddressProc _getProcAddress;
|
private static GetProcAddressProc _getProcAddress;
|
||||||
private static GLEnum1Proc _enable;
|
private static GLEnum1Proc _enable;
|
||||||
private static GLEnum1Proc _disable;
|
private static GLEnum1Proc _disable;
|
||||||
@ -29,6 +33,9 @@ namespace Quik.OpenGL
|
|||||||
private static GLF4Proc _clearColor;
|
private static GLF4Proc _clearColor;
|
||||||
private static DrawElementsProc _drawElements;
|
private static DrawElementsProc _drawElements;
|
||||||
private static DrawArraysProc _drawArrays;
|
private static DrawArraysProc _drawArrays;
|
||||||
|
private static GetIntegervProc _getIntegerv;
|
||||||
|
private static GetFloatvProc _getFloatv;
|
||||||
|
private static GetStringProc _getString;
|
||||||
|
|
||||||
private static T GetProcAddress<T>(string procName)
|
private static T GetProcAddress<T>(string procName)
|
||||||
where T : Delegate
|
where T : Delegate
|
||||||
@ -50,6 +57,9 @@ namespace Quik.OpenGL
|
|||||||
_clearColor = GetProcAddress<GLF4Proc>("glClearColor");
|
_clearColor = GetProcAddress<GLF4Proc>("glClearColor");
|
||||||
_drawElements = GetProcAddress<DrawElementsProc>("glDrawElements");
|
_drawElements = GetProcAddress<DrawElementsProc>("glDrawElements");
|
||||||
_drawArrays = GetProcAddress<DrawArraysProc>("glDrawArrays");
|
_drawArrays = GetProcAddress<DrawArraysProc>("glDrawArrays");
|
||||||
|
_getIntegerv = GetProcAddress<GetIntegervProc>("glGetIntegerv");
|
||||||
|
_getFloatv = GetProcAddress<GetFloatvProc>("glGetFloatv");
|
||||||
|
_getString = GetProcAddress<GetStringProc>("glGetString");
|
||||||
|
|
||||||
LoadBuffer();
|
LoadBuffer();
|
||||||
LoadProgram();
|
LoadProgram();
|
||||||
@ -79,5 +89,36 @@ namespace Quik.OpenGL
|
|||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void DrawArrays(GLEnum primitive, int count, int offset) => _drawArrays(primitive, count, (void*)offset);
|
public static void DrawArrays(GLEnum primitive, int count, int offset) => _drawArrays(primitive, count, (void*)offset);
|
||||||
|
|
||||||
|
[MethodImpl(AggressiveInlining)]
|
||||||
|
public static void Get(GLEnum pname, out int value)
|
||||||
|
{
|
||||||
|
value = default;
|
||||||
|
fixed(int* ptr = &value)
|
||||||
|
{
|
||||||
|
_getIntegerv(pname, ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(AggressiveInlining)]
|
||||||
|
public static void Get(GLEnum pname, out float value)
|
||||||
|
{
|
||||||
|
value = default;
|
||||||
|
fixed (float* ptr = &value)
|
||||||
|
{
|
||||||
|
_getFloatv(pname, ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(AggressiveInlining)]
|
||||||
|
public static string GetString(GLEnum pname)
|
||||||
|
{
|
||||||
|
int length;
|
||||||
|
byte* str = _getString(pname);
|
||||||
|
|
||||||
|
for (length = 0; str[length] == 0 || length < 256; length++);
|
||||||
|
|
||||||
|
return System.Text.Encoding.UTF8.GetString(str, length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,14 @@ namespace Quik.OpenGL
|
|||||||
{
|
{
|
||||||
public enum GLEnum : int
|
public enum GLEnum : int
|
||||||
{
|
{
|
||||||
|
GL_OK = 0,
|
||||||
|
GL_MAJOR_VERSION = 0x821B,
|
||||||
|
GL_MINOR_VERSION = 0x821C,
|
||||||
|
GL_VENDOR = 0x1F00,
|
||||||
|
GL_RENDERER = 0x1F01,
|
||||||
|
GL_VERSION = 0x1F02,
|
||||||
|
GL_EXTENSIONS = 0x1F03,
|
||||||
|
|
||||||
GL_MULTISAMPLE = 0x809D,
|
GL_MULTISAMPLE = 0x809D,
|
||||||
GL_BLEND = 0x0BE2,
|
GL_BLEND = 0x0BE2,
|
||||||
|
|
||||||
@ -31,6 +39,14 @@ namespace Quik.OpenGL
|
|||||||
|
|
||||||
GL_STREAM_DRAW = 0x88E0,
|
GL_STREAM_DRAW = 0x88E0,
|
||||||
|
|
||||||
|
GL_TEXTURE0 = 0x84C0,
|
||||||
|
GL_TEXTURE1 = GL_TEXTURE0 + 1,
|
||||||
|
GL_TEXTURE2 = GL_TEXTURE0 + 2,
|
||||||
|
GL_TEXTURE3 = GL_TEXTURE0 + 3,
|
||||||
|
GL_TEXTURE4 = GL_TEXTURE0 + 4,
|
||||||
|
GL_TEXTURE5 = GL_TEXTURE0 + 5,
|
||||||
|
GL_TEXTURE6 = GL_TEXTURE0 + 6,
|
||||||
|
|
||||||
GL_TEXTURE_2D = 0x0DE1,
|
GL_TEXTURE_2D = 0x0DE1,
|
||||||
GL_UNPACK_ALIGNMENT = 0x0CF5,
|
GL_UNPACK_ALIGNMENT = 0x0CF5,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user