daily update on 20240226 by nitload youmu
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
using StgSharp.Geometries;
|
||||
//using StgSharp.Envitronment.Win32;
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Logic;
|
||||
using StgSharp.Math;
|
||||
using StgSharp.Math.Linear;
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
@@ -12,17 +14,16 @@ using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
|
||||
public class StgSharpDemoForm : Form
|
||||
{
|
||||
Uniform<float, float, float> color;
|
||||
ElementBuffer ebo;
|
||||
Uniform<int> ourTexture;
|
||||
Uniform<int> ourTexture2;
|
||||
ShaderProgram shader;
|
||||
Texture texture;
|
||||
VertexArray vao;
|
||||
VertexBuffer vbo;
|
||||
private Uniform<float, float, float> color;
|
||||
private ElementBuffer ebo;
|
||||
private Uniform<int> ourTexture;
|
||||
private Uniform<int> ourTexture2;
|
||||
private ShaderProgram shader;
|
||||
private Texture texture;
|
||||
private VertexArray vao;
|
||||
private VertexBuffer vbo;
|
||||
|
||||
public static unsafe void ProcessInput(IntPtr windowPtr)
|
||||
{
|
||||
@@ -54,7 +55,7 @@ namespace StgSharp
|
||||
InternalIO.InternalWriteLog("\n\n\n", "Program start", LogType.Info);
|
||||
|
||||
Platform.InitGL(4, 6);
|
||||
SetRenderThreads(1);
|
||||
SetRenderThreads(2);
|
||||
|
||||
SetMetadata(800, 600, "Hello, STG#!", IntPtr.Zero, null);
|
||||
MakeAsCurrentContext();
|
||||
@@ -65,9 +66,7 @@ namespace StgSharp
|
||||
{
|
||||
gl.Viewport(0, 0, width, height);
|
||||
};
|
||||
|
||||
this.LoadGLapi(null);
|
||||
Console.WriteLine(gl);
|
||||
|
||||
shader = CreateShaderProgram();
|
||||
var vertex = CreateShader(ShaderType.Vertex, 1);
|
||||
@@ -77,8 +76,6 @@ namespace StgSharp
|
||||
fragment.Compile(File.ReadAllText("Shader\\fragment.frag"));
|
||||
fragment.AttachTo(0, shader);
|
||||
|
||||
Console.WriteLine(vertex);
|
||||
|
||||
shader.Link();
|
||||
|
||||
Triangle tri = new Triangle(
|
||||
@@ -107,8 +104,6 @@ namespace StgSharp
|
||||
ebo = CreateElementBuffer(1);
|
||||
texture = CreateTexture(2);
|
||||
|
||||
Console.WriteLine(texture);
|
||||
|
||||
float[] texCoord = {
|
||||
0.0f, 0.0f,
|
||||
1.0f, 0.0f,
|
||||
@@ -129,13 +124,9 @@ namespace StgSharp
|
||||
gl.BindBuffer(BufferType.ARRAY_BUFFER, glHandle.Zero);
|
||||
vao.BindNull();
|
||||
/**/
|
||||
|
||||
Console.WriteLine(vao);
|
||||
|
||||
texture.Bind2D(0);
|
||||
texture.Set2dWrapProperty(Wrap.Repeat, Wrap.Repeat);
|
||||
texture.Set2dFilterProperty(Filter.Nearest, Filter.Nearest);
|
||||
Console.WriteLine(texture);
|
||||
texture.LoadTexture(0, "Shader\\Image1.png", null);
|
||||
|
||||
texture.Bind2D(1);
|
||||
@@ -153,12 +144,10 @@ namespace StgSharp
|
||||
ourTexture2 = shader.GetUniform<int>("ourTexture2");
|
||||
gl.SetValue(ourTexture2, 1);
|
||||
/**/
|
||||
Console.WriteLine(this);
|
||||
}
|
||||
|
||||
public override void Main(params object[] args)
|
||||
{
|
||||
|
||||
ProcessInput(windowID);
|
||||
|
||||
gl.ClearColor(0.333f, 0.555f, 0.555f, 1.0f);
|
||||
@@ -195,14 +184,17 @@ namespace StgSharp
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
|
||||
internal unsafe static void Main(string[] args)
|
||||
internal static unsafe void Main(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Platform.TryCreatWindow();
|
||||
|
||||
/**/
|
||||
StgSharpDemoForm demoForm = new StgSharpDemoForm();
|
||||
demoForm.Init();
|
||||
demoForm.Show();
|
||||
/**/
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -212,13 +204,8 @@ namespace StgSharp
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[DllImport(InternalIO.SSC_libname, EntryPoint = "printShaderCode",
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal extern unsafe static void PrintShader(byte** shadercode);
|
||||
|
||||
|
||||
internal static extern unsafe void PrintShader(byte** shadercode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user