daily update on 20231016 by nitload youmu, vao,vbo,ebo struct added

This commit is contained in:
Nitload
2023-10-17 01:22:30 +08:00
parent 6c3349f5a2
commit 614fabe26c
135 changed files with 28619 additions and 5432 deletions
+63 -62
View File
@@ -6,7 +6,6 @@ using System.Diagnostics;
using System.IO;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
namespace StgSharp
@@ -17,61 +16,30 @@ namespace StgSharp
internal unsafe static void Main(string[] args)
{
internalIO.InternalWriteLog("\n\n\n", "Program start", LogType.Info);
Graphic.InitGL(3, 3);
Graphic.InitGL(4, 6);
Form f = Graphic.GLcreateWindow(
Form f = Graphic.CreateWindow(
800, 600, "Test STG#!", IntPtr.Zero, null
);
Graphic.GLmakeContexCurrent(f);
internalIO.glfwSetFramebufferSizeCallback(f.windowID, FormSizeCallback);
Graphic.MakeContexCurrent(f);
Graphic.SetFrameBufferSizeCallback(f, FormSizeCallback);
GetApiRep();
Graphic.InitGLAD(Graphic.GetProcAddress);
Graphic.InitGLManager(Graphic.GetProcAddress);
string vertstr = File.ReadAllText("Shader\\vertex.vert", Encoding.ASCII);
byte[] vert = Encoding.ASCII.GetBytes(vertstr + '\0');
uint vertexShader;
fixed (byte* shaderSource = vert)
{
vertexShader = internalIO.InternalLoadShaderCode(shaderSource, GLFW.GL_VERTEX_SHADER);
if (vertexShader == 0)
{
return;
}
}
Shader shader = new Shader();
shader.CompileVertexShader(
File.ReadAllText("Shader\\vertex.vert")
);
shader.CompileFragmentShader(
File.ReadAllText("Shader\\fragment.frag")
);
shader.Link();
string fragstr = File.ReadAllText("Shader\\fragment.frag", Encoding.ASCII);
byte[] frag = Encoding.ASCII.GetBytes(fragstr + '\0');
uint fragmentShader;
fixed (byte* shaderSource = frag)
{
fragmentShader = internalIO.InternalLoadShaderCode(shaderSource, GLFW.GL_FRAGMENT_SHADER);
if (fragmentShader == 0)
{
return;
}
}
uint shaderProgram = Graphic.glCreateProgram();
Graphic.glAttachShader(shaderProgram, vertexShader);
Graphic.glAttachShader(shaderProgram, fragmentShader);
if (internalIO.InternalLinkShaderProgram(shaderProgram) == 0)
{
IntPtr log = internalIO.InternalReadLog();
Console.WriteLine(Marshal.PtrToStringAnsi(log));
}
Graphic.glDeleteShader(vertexShader);
Graphic.glDeleteShader(fragmentShader);
Triangle tri = new Triangle(
-0.5f, -0.3f, 0.0f,
@@ -80,16 +48,30 @@ namespace StgSharp
);
Rectangle rec = new Rectangle(
-0.5f, 0.5f, 0.0f,
-0.4f, 0.5f, 0.0f,
0.5f, 0.5f, 0.0f,
0.5f, -0.5f, 0.0f,
-0.5f, -0.5f, 0.0f
0.6f, -0.5f, 0.0f,
-0.7f, -0.5f, 0.0f
);
Polygon5 polygon = new Polygon5(
-0.4f, 0.5f, 0.0f,
0.5f, 0.5f, 0.0f,
0.6f, -0.5f, 0.0f,
0, -1, 0,
-0.7f, -0.5f, 0.0f
);
VertexArray vao = new VertexArray(1);
vao.Bind();
/*
uint VAO;
Graphic.glGenVertexArrays(1, &VAO);
Graphic.glBindBuffer(GLFW.GL_ARRAY_BUFFER, VAO);
Graphic.glBindVertexArray(VAO);
/**/
/*
// for triangle rendering
@@ -109,27 +91,38 @@ namespace StgSharp
/**/
// for rectangle rendering
VertexBuffer vbo = new VertexBuffer(1);
vbo.Bind();
vbo.SetData(polygon.VertexBuffer, BufferReadType.STATIC_DRAW);
/*
uint VBO;
Graphic.glGenBuffers(1, &VBO);
Graphic.glBindBuffer(GLFW.GL_ARRAY_BUFFER, VBO);
Graphic.SetBufferData(BufferType.ARRAY_BUFFER, polygon.VertexBuffer, BufferReadType.STATIC_DRAW);
/**/
/*
fixed (void* data = &rec.vertexMat)
{
Graphic.glBufferData(GLFW.GL_ARRAY_BUFFER, 16 * sizeof(float), data, GLFW.GL_STATIC_DRAW);
}
/**/
uint[] indices = new uint[6]
{
0,1,3,
1,2,3
};
ElementBuffer ebo = new ElementBuffer(1);
ebo.Bind();
ebo.SetData(polygon.Indices, BufferReadType.STATIC_DRAW);
/*
uint EBO;
Graphic.glGenBuffers(1, &EBO);
Graphic.glBindBuffer(GLFW.GL_ELEMENT_ARRAY_BUFFER, EBO);
fixed (void* data = &indices[0])
{
Graphic.glBufferData(GLFW.GL_ELEMENT_ARRAY_BUFFER, indices.Length * sizeof(uint), data, GLFW.GL_STATIC_DRAW);
}
Graphic.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, polygon.Indices, BufferReadType.STATIC_DRAW);
/**/
Graphic.glVertexAttribPointer(0, 3, GLFW.GL_FLOAT, false, 4 * sizeof(float), (void*)0);
Graphic.glEnableVertexAttribArray(0);
@@ -144,14 +137,15 @@ namespace StgSharp
{
ProcessInput(f.windowID);
Graphic.glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
Graphic.ClearColor(0.2f, 0.3f, 0.3f, 1.0f);
Graphic.glClear(GLFW.GL_COLOR_BUFFER_BIT);
Graphic.glUseProgram(shaderProgram);
Graphic.glBindVertexArray(VAO);
shader.Use();
Graphic.glBindVertexArray(vao._bufferID);
//Graphic.glDrawArrays(GLFW.GL_TRIANGLES, 0, 3);
Graphic.glDrawElements(GLFW.GL_TRIANGLES, 6, GLFW.GL_UNSIGNED_INT, (void*)0);
Graphic.glDrawElements(GLFW.GL_TRIANGLES, 9, GLFW.GL_UNSIGNED_INT, (void*)0);
Graphic.glBindVertexArray(0);
@@ -159,9 +153,16 @@ namespace StgSharp
internalIO.glfwPollEvents();
}
vao.Dispose();
vbo.Dispose();
ebo.Dispose();
/*
Graphic.glDeleteVertexArrays(1, &VAO);
Graphic.glDeleteBuffers(1, &VBO);
Graphic.glDeleteBuffers(1, &EBO);
/**/
internalIO.glfwTerminate();
}
@@ -0,0 +1,198 @@
Info @ 2023-10-12T03:19:58.7324364+08:00
Program start
Error @2023-10-12T03:19:58.9477954+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNTEXIMAGEPROC, this API may not exist.
Error @2023-10-12T03:19:58.9482257+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNUNIFORMDVPROC, this API may not exist.
Error @2023-10-12T03:19:58.9485975+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPDVPROC, this API may not exist.
Error @2023-10-12T03:19:58.9488976+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPFVPROC, this API may not exist.
Error @2023-10-12T03:19:58.9492129+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPIVPROC, this API may not exist.
Error @2023-10-12T03:19:58.9495375+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPFVPROC, this API may not exist.
Error @2023-10-12T03:19:58.9498299+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPUIVPROC, this API may not exist.
Error @2023-10-12T03:19:58.9501350+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPUSVPROC, this API may not exist.
Error @2023-10-12T03:19:58.9504419+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPOLYGONSTIPPLEPROC, this API may not exist.
Error @2023-10-12T03:19:58.9509285+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNCOLORTABLEPROC, this API may not exist.
Error @2023-10-12T03:19:58.9512426+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNCONVOLUTIONFILTERPROC, this API may not exist.
Error @2023-10-12T03:19:58.9516907+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNSEPARABLEFILTERPROC, this API may not exist.
Error @2023-10-12T03:19:58.9519956+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNHISTOGRAMPROC, this API may not exist.
Error @2023-10-12T03:19:58.9524417+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMINMAXPROC, this API may not exist.
Error @2023-10-12T03:19:58.9532268+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC, this API may not exist.
Error @2023-10-12T03:19:58.9535437+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC, this API may not exist.
Error @2023-10-12T03:19:58.9567819+08:00
Failed to compile shader.
Failed to get GLSL compiler log
Info @ 2023-10-12T03:21:10.3239543+08:00
Program start
Error @2023-10-12T03:21:10.5396246+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNTEXIMAGEPROC, this API may not exist.
Error @2023-10-12T03:21:10.5400425+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNUNIFORMDVPROC, this API may not exist.
Error @2023-10-12T03:21:10.5405159+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPDVPROC, this API may not exist.
Error @2023-10-12T03:21:10.5408213+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPFVPROC, this API may not exist.
Error @2023-10-12T03:21:10.5411072+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPIVPROC, this API may not exist.
Error @2023-10-12T03:21:10.5415211+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPFVPROC, this API may not exist.
Error @2023-10-12T03:21:10.5418449+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPUIVPROC, this API may not exist.
Error @2023-10-12T03:21:10.5422912+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPUSVPROC, this API may not exist.
Error @2023-10-12T03:21:10.5426171+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPOLYGONSTIPPLEPROC, this API may not exist.
Error @2023-10-12T03:21:10.5429361+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNCOLORTABLEPROC, this API may not exist.
Error @2023-10-12T03:21:10.5432113+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNCONVOLUTIONFILTERPROC, this API may not exist.
Error @2023-10-12T03:21:10.5434825+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNSEPARABLEFILTERPROC, this API may not exist.
Error @2023-10-12T03:21:10.5438002+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNHISTOGRAMPROC, this API may not exist.
Error @2023-10-12T03:21:10.5440688+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMINMAXPROC, this API may not exist.
Error @2023-10-12T03:21:10.5448575+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC, this API may not exist.
Error @2023-10-12T03:21:10.5451568+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC, this API may not exist.
Error @2023-10-12T03:21:10.5486110+08:00
WARNING: 0:1: '' : #version directive missing
ERROR: 0:1: '000' : syntax error syntax error
Info @ 2023-10-12T03:30:21.8443425+08:00
Program start
Error @ 2023-10-12T03:30:22.0611696+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNTEXIMAGEPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0616111+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNUNIFORMDVPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0619801+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPDVPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0622986+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPFVPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0625983+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPIVPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0628976+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPFVPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0631880+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPUIVPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0635372+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPUSVPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0638550+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPOLYGONSTIPPLEPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0642010+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNCOLORTABLEPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0644943+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNCONVOLUTIONFILTERPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0648024+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNSEPARABLEFILTERPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0650890+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNHISTOGRAMPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0653715+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMINMAXPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0661823+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC, this API may not exist.
Error @ 2023-10-12T03:30:22.0664910+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC, this API may not exist.
Info @ 2023-10-14T17:37:50.5533658+08:00
Program start
Error @ 2023-10-14T17:37:50.7759452+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNTEXIMAGEPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7763345+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNUNIFORMDVPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7767533+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPDVPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7770227+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPFVPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7772878+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPIVPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7775394+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPFVPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7777922+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPUIVPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7790220+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPUSVPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7792883+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPOLYGONSTIPPLEPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7795385+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNCOLORTABLEPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7797798+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNCONVOLUTIONFILTERPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7800150+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNSEPARABLEFILTERPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7802471+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNHISTOGRAMPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7804766+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMINMAXPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7812494+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC, this API may not exist.
Error @ 2023-10-14T17:37:50.7815166+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC, this API may not exist.
Info @ 2023-10-17T01:20:46.8252003+08:00
Program start
Error @ 2023-10-17T01:20:47.1820184+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNTEXIMAGEPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1824725+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNUNIFORMDVPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1830568+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPDVPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1833733+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPFVPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1836861+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMAPIVPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1840030+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPFVPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1843191+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPUIVPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1846322+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPIXELMAPUSVPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1849560+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNPOLYGONSTIPPLEPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1852808+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNCOLORTABLEPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1855842+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNCONVOLUTIONFILTERPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1858751+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNSEPARABLEFILTERPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1861646+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNHISTOGRAMPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1864511+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLGETNMINMAXPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1874607+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC, this API may not exist.
Error @ 2023-10-17T01:20:47.1878654+08:00
Cannot load OpenGL API called StgSharp.Graphics.PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC, this API may not exist.
@@ -1 +1 @@
208acf897e20abb578d5ef8df864296ff6184c25
a316b7e2a6832a40e13c8c0573c75a737e389983