46 lines
888 B
C++
46 lines
888 B
C++
|
#include "Graphics/RenderSurface.h";
|
||
|
|
||
|
RenderSurface::RenderSurface(){
|
||
|
shader = new Shader("build/SandboxAppliction/Debug/renderSuface.vs", "build/SandboxApplication/Debug/renderSurface.fs");
|
||
|
|
||
|
|
||
|
|
||
|
verts = std::vector<glm::vec3>{
|
||
|
{-0.5f, 0.5f, 0.0f}, // 0
|
||
|
{-0.5f, -0.5f, 0.0f}, // 1
|
||
|
{0.5f, -0.5f, 0.0f}, // 2
|
||
|
{0.5f, 0.5f, 0.0f}, // 3
|
||
|
};
|
||
|
|
||
|
indices = std::vector<unsigned int>{
|
||
|
0,2,1,
|
||
|
0,3,2
|
||
|
};
|
||
|
|
||
|
VAO.Create();
|
||
|
VAO.Bind();
|
||
|
|
||
|
vertexBuffer.createBuffer();
|
||
|
vertexBuffer.Bind(false);
|
||
|
vertexBuffer.setBufferData(&verts[0], verts.size() * sizeof(glm::vec3), false);
|
||
|
|
||
|
elementBuffer.createBuffer();
|
||
|
elementBuffer.Bind(true);
|
||
|
elementBuffer.setBufferData(&indices[0], indices.size() * sizeof(unsigned int), true);
|
||
|
|
||
|
VAO.AttachAttribute(0, 3, 0);
|
||
|
|
||
|
vertexBuffer.Unbind(false);
|
||
|
VAO.Unbind();
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
RenderSurface::~RenderSurface() {
|
||
|
delete shader;
|
||
|
}
|
||
|
|
||
|
void RenderSurface::Draw() {
|
||
|
|
||
|
}
|