Created
February 6, 2018 12:33
-
-
Save Quaker762/43f1cec68477b6ed6e26265da9fd25a6 to your computer and use it in GitHub Desktop.
Fucking gcc template bug...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
...... | |
// HACK HACK: g++ 7.1 will NOT compile the following template | |
// without the bracketed namespaces. | |
// | |
// Refer to: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 | |
namespace erpg{namespace gl{ | |
template<> | |
void Program::SetUniform<int>(const std::string& name, int value) | |
{ | |
} | |
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @file | |
* | |
* Logical OpenGL GLSL Shader Program. | |
* | |
* @copyright 2018 Euclidean Entertainment | |
* | |
* @date 6-2-2018 | |
* | |
* @author Jesse Buhagiar | |
*/ | |
#ifndef GLPROGRAM_HPP_INCLUDED | |
#define GLPROGRAM_HPP_INCLUDED | |
#include "erpg1/system/glshader.hpp" | |
#include <list> | |
#include <vector> | |
#include <GL/gl.h> | |
namespace erpg{namespace gl{ | |
/** | |
* Our OpenGL program class. This class can be inherited by effect classes. | |
*/ | |
class Program | |
{ | |
public: | |
Program(); | |
/** | |
* Class Constructor | |
* | |
* @arg shader_list List of shaders that we want to attach to this program. | |
*/ | |
Program(std::vector<Shader>& shader_list); | |
/** | |
* Add a shader to the list of this programs shaders | |
* | |
* @arg shader Reference to shader we want to attach | |
*/ | |
void AttachShader(const Shader& shader); | |
/** | |
* Creates a GLSL Shader program by linking all attached shaders | |
*/ | |
void Create(); | |
/** | |
* Bind this Program for use on the next draw call OpenGL makes | |
*/ | |
void Bind() const; | |
/** | |
* Unbind this Program from use | |
*/ | |
void Unbind() const; | |
/** | |
* Get the location of a uniform in this shader program | |
* | |
* @arg name Name of the uniform whose location we want to get. | |
*/ | |
GLint GetUniformLocation(const std::string& name); | |
/** | |
* Set a uniform value in our shader | |
*/ | |
template<typename T> | |
void SetUniform(const std::string& name, T value); | |
private: | |
/** | |
* Link all shaders in the shaders list | |
*/ | |
void Link(); | |
private: | |
GLuint id; /**< ID of this shader generated by glCreateProgram() */ | |
std::list<Shader> shaders; /**< List of shaders attached to this Shader Program */ | |
std::string name; /**< Name of this shader */ | |
}; | |
}} | |
#endif // GLPROGRAM_HPP_INCLUDED |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment