compile shaders
This commit is contained in:
parent
6f5873c8be
commit
5d3fb630c9
37
src/main.c
37
src/main.c
|
@ -1,8 +1,38 @@
|
|||
#include <GL/glew.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "shader.h"
|
||||
#include "log.h"
|
||||
#include "src/shader.h"
|
||||
|
||||
void init(void) {
|
||||
INFO("Compiling Shaders...\n");
|
||||
|
||||
// create and compile vertex shader
|
||||
INFO("Compiling Vertex Shader...\n");
|
||||
ShaderCompileResult vertexShader = readAndCompileShaderFromFile("src/shaders/vertex.glsl", GL_VERTEX_SHADER);
|
||||
|
||||
// create and compile fragment shader
|
||||
ShaderCompileResult fragmentShader = readAndCompileShaderFromFile("src/shaders/fragment.glsl", GL_FRAGMENT_SHADER);
|
||||
|
||||
if (!vertexShader.success) {
|
||||
FATAL("Failed to compile Vertex Shader\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!fragmentShader.success) {
|
||||
FATAL("Failed to compile Vertex Shader\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// create and link shader program
|
||||
|
||||
// create triangle buffer
|
||||
|
||||
// create vertex array object
|
||||
|
||||
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
|
||||
}
|
||||
|
||||
|
@ -16,6 +46,13 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
|
|||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-v") == 0) {
|
||||
logLevel = LOG_LEVEL_DEBUG;
|
||||
}
|
||||
}
|
||||
|
||||
glfwInit();
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
|
|
Loading…
Reference in New Issue