parent
25a0f13ba2
commit
3574738dd8
@ -0,0 +1,22 @@ |
||||
#include <glad/glad.h> |
||||
#include <string> |
||||
#include <vector> |
||||
|
||||
namespace Shaders { |
||||
std::string loadSourceFromFile(const char* file); |
||||
|
||||
unsigned int compile(GLenum shadertype, const char* shaderSource); |
||||
unsigned int compileFromFile(GLenum shadertype, const char* file);
|
||||
unsigned int createProgram(std::vector<unsigned int> shaders); |
||||
|
||||
class Shader { |
||||
public: |
||||
unsigned int id; |
||||
Shader(const char* vertPath, const char* fragPath); |
||||
|
||||
void use(); |
||||
void setBool(const std::string &name, bool val) const; |
||||
void setInt(const std::string &name, int val) const; |
||||
void setFloat(const std::string &name, float val) const; |
||||
}; |
||||
} |
@ -1,8 +1,7 @@ |
||||
#version 330 core |
||||
out vec4 FragColor; |
||||
|
||||
uniform vec4 inputColor; |
||||
in vec4 vertexColor; |
||||
|
||||
void main() { |
||||
FragColor = inputColor; |
||||
FragColor = vertexColor; |
||||
} |
||||
|
@ -1,9 +1,10 @@ |
||||
#version 330 core |
||||
layout (location = 0) in vec3 aPos; |
||||
layout (location = 1) in vec3 aColor; |
||||
|
||||
out vec4 vertexColor; |
||||
|
||||
void main() { |
||||
gl_Position = vec4(aPos, 1.0); |
||||
vertexColor = vec4(1.0f, 1.0f, 1.0f, 0.0f); |
||||
vertexColor = vec4(aColor, 1.0); |
||||
} |
||||
|
@ -0,0 +1,25 @@ |
||||
#ifndef SHADERS_H |
||||
#define SHADERS_H |
||||
#include <glad/glad.h> |
||||
#include <string> |
||||
#include <vector> |
||||
|
||||
namespace Shaders { |
||||
std::string loadSourceFromFile(const char* file); |
||||
|
||||
unsigned int compile(GLenum shadertype, const char* shaderSource); |
||||
unsigned int compileFromFile(GLenum shadertype, const char* file);
|
||||
unsigned int createProgram(std::vector<unsigned int> shaders); |
||||
|
||||
class Shader { |
||||
public: |
||||
unsigned int id; |
||||
Shader(const char* vertPath, const char* fragPath); |
||||
|
||||
void use(); |
||||
void setBool(const std::string &name, bool val) const; |
||||
void setInt(const std::string &name, int val) const; |
||||
void setFloat(const std::string &name, float val) const; |
||||
}; |
||||
} |
||||
#endif |
Loading…
Reference in new issue