47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using System.Numerics;
|
|
using System.Windows.Forms;
|
|
using SharpGL.Shaders;
|
|
using SharpGL;
|
|
using SharpGL.Enumerations;
|
|
using System.Reflection;
|
|
using System.IO;
|
|
using System.Collections.Generic;
|
|
using System;
|
|
using SharpGL.VertexBuffers;
|
|
|
|
namespace Graphics.Objects {
|
|
class gridBackground : iGraphicalObject {
|
|
|
|
VertexBuffer vbo = new VertexBuffer();
|
|
VertexBufferArray vao = new VertexBufferArray();
|
|
ShaderProgram gridRender = new ShaderProgram();
|
|
|
|
public gridBackground(renderCam context) {
|
|
vao.Create(context.GL);
|
|
vao.Bind(context.GL);
|
|
gridRender.Create(context.GL, Shader.FromFile("default.vert"),
|
|
Shader.FromFile("background.frag"), new Dictionary<uint, string>()
|
|
{ { 0, "position" } });
|
|
vbo.Create(context.GL);
|
|
vbo.Bind(context.GL);
|
|
vbo.SetData(context.GL, 0, new float[] { -1.0f, -1.0f,
|
|
1.0f, -1.0f,
|
|
1.0f, 1.0f,
|
|
-1.0f, 1.0f }, false, 2);
|
|
vao.Unbind(context.GL);
|
|
}
|
|
|
|
const double realTileSize = 24.0f;
|
|
public void render(renderCam context) {
|
|
|
|
gridRender.Bind(context.GL);
|
|
|
|
vao.Bind(context.GL);
|
|
context.GL.DrawArrays(OpenGL.GL_QUADS, 0, 8);
|
|
|
|
vao.Unbind(context.GL);
|
|
gridRender.Unbind(context.GL);
|
|
}
|
|
}
|
|
}
|