DI-Guy C++ SDK Reference  13.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyOglGraphicsShaderProgram.h
Go to the documentation of this file.
1 #ifndef __diguyOglGraphicsShaderProgram_H
2 #define __diguyOglGraphicsShaderProgram_H
3 
4 
5 
6 #include "ogl_headers.h"
7 
9 
11 #include <hash_map>
12 
13 
14 /*********************************************************************
15  **
16  *2 diguyOglGraphicsShaderProgram
17  **
18  ** This class is part of the DI-Guy Graphics API. It overrides the class
19  ** diguyGraphicsShaderProgram. Detailed documentation is in the
20  ** implementation file documentation
21  ** <a href="diguyOglGraphicsShaderProgram.cpp.html">here</a>.
22  */
23 
25 {
26 
27 public:
28 
29  diguyOglGraphicsShaderProgram(void* internal_data);
31 
32  virtual int load_vertex_shader_source(const char* filename_base);
33  virtual int load_pixel_shader_source(const char* filename_base);
34  virtual int reload();
35  virtual int link();
36 
37  virtual int bind();
38  virtual int unbind();
39 
41 
42  GLhandleARB m_gl_program_object;
43 
44  /*
45  * Though looked up here, these bind locations are used in
46  * diguyOglGraphicsMesh.cpp.
47  */
51 
57 
61 
64 
66 
70 
73 
76 
77  /*
78  * Uniform for controlling whether links matrices are applied to
79  * vertices in the vertex shader. Set from the mesh draw() function.
80  */
81  virtual void set_apply_matrices_flag(int apply_matrices_flag);
82 
83  /*
84  * Called by diguy internal code to send data to the shaders.
85  */
86  virtual int bind_color_array(int num_colors,
87  const float* color_data);
88  virtual int bind_link_matrices(int num_mats,
89  const float* mat_data);
90 
91  virtual int bind_uniform_with_location(int location,
92  const char* name,
93  int value_size,
94  float* values);
95  virtual int bind_uniform_with_location(int location,
96  const char* name,
97  int value_size,
98  int* values);
99 
100  /*
101  * Called by diguy internal find out what capabilities the shader has.
102  */
103  virtual int get_attrib_bind_location(const char* name);
104  virtual int get_uniform_bind_location(const char* name);
105 
106  /*
107  * These are render state variables whose values are set by DI-Guy.
108  * They should not be set in bind(), but in the appropriate
109  * diguyOglGraphicsShaderInstance virtual functions.
110  */
111 
112 protected:
113 
114  int load_and_compile_shader(GLhandleARB shader_object,
115  const char* shader_filename,
116  bool& shader_loaded);
117 
118  char* load_shader_source(const char* shader_filename);
119  void free_shader_source(char* source_source);
130  bool m_linked;
132  const float * m_last_matrix_data;
133 
134 };
135 
136 
142 
143 
144 #endif