GlProgram.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "gl.h"
5 #include <string>
6 
7 
8 namespace iv
9 {
10 
14 class GlProgram
15 {
16 public:
17  GlProgram();
18 
19  //------------------------- loading ------
20  void CreateProgram( ClientMarker const * logger );
21  void Load_VertexShader( ClientMarker const * logger, std::istream & in );
22  void Load_FragmentShader( ClientMarker const * logger, std::istream & in );
23  void BindAttribute( ClientMarker const * logger, GLuint location, const char * attrib_name );
24  void PositionAttributeName( ClientMarker const * logger, const char * name );
25  void LinkProgram( ClientMarker const * logger );
26  void DestroyProgram( ClientMarker const * logger );
27  void DropProgram( ClientMarker const * logger );
28 
29  //------------------------- getters -------------------
30  GLuint program_id() const;
31  GLint GetUniformLocation( const char * name ) const;
32 
33 private:
34  static std::string ExtractShaderInfoLog( GLuint shader );
35  static std::string ExtractProgramInfoLog( GLuint program );
36 
37 private:
38  GLuint _program_id;
39  bool _linked;
40  GLuint _vertex_id;
41  GLuint _fragment_id;
42 };
43 
44 }