Can now load models from file, kinda

This commit is contained in:
Robert 2021-01-22 13:37:57 +01:00
parent 4c3c1687ef
commit ac5bf9abdb
13 changed files with 10247 additions and 12 deletions

View file

@ -47,10 +47,10 @@ int main(int argc, char** argv)
// Create vertices for square
float vertices[] = {
0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top right
0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom right
-0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom left
-0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f // top left
0.5f, 0.5f, 0.0f, 1.0f, 1.0f, // top right
0.5f, -0.5f, 0.0f, 1.0f, 0.0f, // bottom right
-0.5f, -0.5f, 0.0f, 0.0f, 0.0f, // bottom left
-0.5f, 0.5f, 0.0f, 0.0f, 1.0f // top left
};
unsigned int indices[] = {
@ -59,9 +59,8 @@ int main(int argc, char** argv)
};
oglu::VertexAttribute topology[] = {
{ 0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0 },
{ 1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)) },
{ 2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)) }
{ 0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0 },
{ 1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)) }
};
// Make a square

View file

@ -1,5 +1,4 @@
#version 330 core
in vec3 oCol;
in vec2 oUV;
out vec4 FragColor;

View file

@ -1,9 +1,7 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aCol;
layout (location = 2) in vec2 aUV;
layout (location = 1) in vec2 aUV;
out vec3 oCol;
out vec2 oUV;
uniform mat4 model;
@ -12,7 +10,6 @@ uniform mat4 projection;
void main()
{
oCol = aCol;
oUV = aUV;
gl_Position = projection * view * model * vec4(aPos, 1.0);
}