GCP Assignment 1
Shader.h
Go to the documentation of this file.
1 //DISCLAMER - This is a modified version of code from one of my other assignments.
2 
3 #pragma once
4 
5 #include <iostream>
6 #include "GL/glew.h"
7 #include "FileLoader.h"
8 
12 class Shader
13 {
14 public:
20  Shader(std::string vertexShaderFileName, std::string fragmentShaderFileName);
21 
25  ~Shader();
26 
31  GLuint getShaderProgram();
32 
37  GLint getModelMatrixLocation();
38 
43  GLint getViewMatrixLocation();
44 
50 
56 
57 private:
59  GLuint shaderProgram;
62 
68  bool Shader::CheckShaderCompiled(GLint shader);
69 
75  void initaliseShader(std::string shaderFileName, char shaderType);
76 };
GLuint getShaderProgram()
Returns the shader program.
Definition: Shader.cpp:126
GLint shaderViewMatrixLocation
Definition: Shader.h:61
GLint getShaderProjectionMatrixLocation()
Returns the shader projection matrix location.
Definition: Shader.cpp:144
GLint textureSamplerLocation
Definition: Shader.h:61
~Shader()
Destructs the Shader Object deleting the Shader Object from memory.
Definition: Shader.cpp:50
GLint shaderModelMatrixLocation
The Uniform locations for the shader program.
Definition: Shader.h:61
GLint getViewMatrixLocation()
Returns the shader view matrix location.
Definition: Shader.cpp:138
void initaliseShader(std::string shaderFileName, char shaderType)
Initialise a shader.
Definition: Shader.cpp:54
bool CheckShaderCompiled(GLint shader)
A function to test if the shader compiled successfully.
Definition: Shader.cpp:100
GLint getModelMatrixLocation()
Returns the shader model matrix location.
Definition: Shader.cpp:132
Creates a Shader from an text file, this can then be used with OpenGL.
Definition: Shader.h:12
GLuint shaderProgram
The Shader program of the Shader Object.
Definition: Shader.h:59
GLint getTextureSamplerLocation()
Returns the texture sampler location.
Definition: Shader.cpp:150
GLint shaderProjectionMatrixLocation
Definition: Shader.h:61
Shader(std::string vertexShaderFileName, std::string fragmentShaderFileName)
Creates a Shader Object using an shader file location and OpenGL.
Definition: Shader.cpp:5