GPU Splatting  1.0
A deffered render that draws the surface of point cloud data.
GLProgram.h
1 #pragma once
2 
3 #include <GL/glew.h>
4 #include <glm/glm.hpp>
5 #include <vector>
6 #include <map>
7 
8 #include "GLTexture.h"
9 #include "GLShader.h"
10 
11 namespace GL
12 {
14  class GLProgram
15  {
16  public:
17 
18  explicit GLProgram();
19 
21  void initialize();
22  void attachShader(const GLShader& shader);
23  void link();
24  void bind();
25  int getNumberOfAttributes();
26  int getNumberOfUniforms();
27  int getAttributeByName(char const* name);
28  int getUniformByName(char const* name);
29  void bindFragDataLocation(int loc, const char* variableName);
30 
31  // uniform setters
32  void setUniform(const char* name, float u);
33  void setUniform(const char* name, int u);
34  void setUniform(const char* name, const glm::vec2& u);
35  void setUniform(const char* name, const glm::vec3& u);
36  void setUniform(const char* name, const glm::vec4& u);
37  void setUniform(const char* name, const glm::mat3& u);
38  void setUniform(const char* name, const glm::mat4& u);
39  void setUniform(const char* name, const std::vector<glm::mat4>& u);
40  void setUniform(const char* name, const GLTexture& tex, int iTextureSlot);
41 
42  private:
43  GLuint handle;
44  std::map<std::string, GLuint> uniformCache;
45  };
46 }
Encapsules an OpenGL shader program.
Definition: GLProgram.h:14
int getNumberOfUniforms()
Returns the number of Uniforms available.
Definition: GLProgram.cpp:69
void setUniform(const char *name, float u)
Sets the value of the given uniform.
Definition: GLProgram.cpp:105
void link()
Links the program, so it's complete.
Definition: GLProgram.cpp:18
void bind()
Binds the program so it's used for rendering.
Definition: GLProgram.cpp:57
int getAttributeByName(char const *name)
Returns the id of the requested attribute.
Definition: GLProgram.cpp:76
Encapsuls an OpenGL shader.
Definition: GLShader.h:21
Definition: GLProgram.h:11
void bindFragDataLocation(int loc, const char *variableName)
Binds the fragment data with the given name to the location.
Definition: GLProgram.cpp:101
int getUniformByName(char const *name)
Returns the id of the requested uniform.
Definition: GLProgram.cpp:81
void attachShader(const GLShader &shader)
Attaches the given shader to this program.
Definition: GLProgram.cpp:13
void initialize()
Creates a new program.
Definition: GLProgram.cpp:8
Encapsules an OpenGL texture for easier use.
Definition: GLTexture.h:8
int getNumberOfAttributes()
Returns the number of attributes available.
Definition: GLProgram.cpp:62