(broken) texture loading

This commit is contained in:
plane000
2018-09-16 22:28:22 +01:00
parent c8e234b65e
commit 11f63887e9
14 changed files with 171 additions and 44 deletions

View File

@@ -1,29 +1,39 @@
#include <iostream>
#include <GL/glew.h>
#include "headers/display.h"
#include "headers/mesh.h"
#include "headers/shader.h"
#include "display.h"
#include "mesh.h"
#include "shader.h"
#include "texture.h"
#undef main
int main(int argc, char** argv) {
Display display(800, 600, "Crumpet Engine");
Display display(800, 800, "Crumpet Engine");
glClearColor(0.1f, 0.45f, 0.9f, 1.0f);
GLfloat vertices[] = {
-0.5f, -0.5f, 0.0f,
0.5f, -0.5f, 0.0f,
0.0f, 0.5f, 0.0f
// positions // colors // texture coords
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, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f // top left
};
Mesh mesh(vertices, sizeof(vertices) / sizeof(vertices[0]));
Shader shader;
unsigned int indices[] = {
0, 1, 3, // first triangle
1, 2, 3 // second triangle
};
Mesh mesh(vertices, indices, sizeof(vertices) / sizeof(vertices[0]));
Shader shader("E:/Games/Practicing/OpenGL/resources/shaders/simple2d");
Texture chanceCube("E:/Games/Practicing/OpenGL/resources/textures/chance-cube.jpg");
while(!display.isClosed()) {
glClear(GL_COLOR_BUFFER_BIT);
shader.Bind();
chanceCube.Bind(0);
mesh.Draw();
display.Update();