diff options
author | Matthew Kosarek <mattkae@protonmail.com> | 2021-05-16 19:50:15 -0400 |
---|---|---|
committer | Matthew Kosarek <mattkae@protonmail.com> | 2021-05-16 19:50:15 -0400 |
commit | a00c0aab1eb5a7a55bef8ca08115bdd722ab5699 (patch) | |
tree | 45b5c4cc8c380d0630a8e0185af7229f26dc754a /frontend/shared_cpp/Shader.h | |
parent | 4941a1874b6ca9d142d94df70b2aec5e0b35b94e (diff) |
Moved the frontend directory up so that it no longer exists
Diffstat (limited to 'frontend/shared_cpp/Shader.h')
-rw-r--r-- | frontend/shared_cpp/Shader.h | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/frontend/shared_cpp/Shader.h b/frontend/shared_cpp/Shader.h deleted file mode 100644 index 6ee9981..0000000 --- a/frontend/shared_cpp/Shader.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include <GL/glew.h> -#include <string> -#include <vector> -#include "mathlib.h" - -typedef GLuint Shader; - -Shader loadShader(const GLchar* vertexShader, const GLchar* fragmentShader); - -inline GLint getShaderUniform(const Shader& shader, const GLchar *name) { - GLint uid = glGetUniformLocation(shader, name); - if (uid < 0) { - return -1; - } - return uid; -} - -inline GLint getShaderAttribute(const Shader& shader, const GLchar *name) { - printf("Getting attribute for shader, name: %d, %s\n", shader, name); - GLint uid = glGetAttribLocation(shader, name); - if (uid < 0) { - return -1; - } - return uid; -} - -inline void useShader(const Shader& shader) { - glUseProgram(shader); -} - -inline void setShaderFloat(GLint location, GLfloat value) { - glUniform1f(location, value); -} - -inline void setShaderInt(GLint location, GLint value) { - glUniform1i(location, value); -} - -inline void setShaderUint(GLint location, GLuint value) { - glUniform1ui(location, value); -} - -inline void setShaderVec2(GLint location, const Vector2& value) { - glUniform2f(location, value.x, value.y); -} - -inline void setShaderMat4(GLint location, const Mat4x4& matrix) { - glUniformMatrix4fv(location, 1, GL_FALSE, matrix.m); -} - -inline void setShaderBVec3(GLint location, bool first, bool second, bool third) { - glUniform3i(location, first, second, third); -} - -inline void setShaderBVec4(GLint location, bool first, bool second, bool third, bool fourth) { - glUniform4i(location, first, second, third, fourth); -} - -inline void setShaderBool(GLint location, bool value) { - glUniform1i(location, value); -}
\ No newline at end of file |