class: ewol::resource::Program


Description:

Program is a compilation of some fragment Shader and vertex Shader. This construct automaticly this assiciation The input file must have the form : "myFile.prog" The data is simple : <pre> # Comment line ... paid attention at the space at the end of lines, they are considered like a part of the file ... # The folder is automaticly get from the program file basic folder filename1.vert filename2.frag filename3.vert filename4.frag </pre>

Constructor and Destructor:

#                                                              Program                        ();
+ virtual ~Program ();

Synopsis:

# void                                                 init                           (const std::string & _filename);
+ DECLARE_RESOURCE_NAMED_FACTORY (Program );
+ int32_t getAttribute (std::string _elementName);
+ void sendAttribute (int32_t _idElem,
int32_t _nbElement,
const void* _pointer,
int32_t _jumpBetweenSample);
+ void sendAttributePointer (int32_t _idElem,
int32_t _nbElement,
const std::shared_ptr<ewol::resource::VirtualBufferObject> & _vbo,
int32_t _index,
int32_t _jumpBetweenSample,
int32_t _offset);
+ void sendAttribute (int32_t _idElem,
const std::vector<vec2> & _data);
+ void sendAttribute (int32_t _idElem,
const std::vector<vec3> & _data);
+ void sendAttribute (int32_t _idElem,
const std::vector<etk::Color<float>> & _data);
+ void sendAttribute (int32_t _idElem,
const std::vector<float> & _data);
+ int32_t getUniform (std::string _elementName);
+ void uniformMatrix4fv (int32_t _idElem,
int32_t _nbElement,
mat4 _pointer,
bool _transpose);
+ void uniform (int32_t _idElem,
const etk::Color<float> & _value);
+ void uniform1f (int32_t _idElem,
float _value1);
+ void uniform2f (int32_t _idElem,
float _value1,
float _value2);
+ void uniform3f (int32_t _idElem,
float _value1,
float _value2,
float _value3);
+ void uniform4f (int32_t _idElem,
float _value1,
float _value2,
float _value3,
float _value4);
+ void uniform1i (int32_t _idElem,
int32_t _value1);
+ void uniform2i (int32_t _idElem,
int32_t _value1,
int32_t _value2);
+ void uniform3i (int32_t _idElem,
int32_t _value1,
int32_t _value2,
int32_t _value3);
+ void uniform4i (int32_t _idElem,
int32_t _value1,
int32_t _value2,
int32_t _value3,
int32_t _value4);
+ void uniform1fv (int32_t _idElem,
int32_t _nbElement,
const float* _value);
+ void uniform2fv (int32_t _idElem,
int32_t _nbElement,
const float* _value);
+ void uniform3fv (int32_t _idElem,
int32_t _nbElement,
const float* _value);
+ void uniform4fv (int32_t _idElem,
int32_t _nbElement,
const float* _value);
+ void uniform1iv (int32_t _idElem,
int32_t _nbElement,
const int32_t* _value);
+ void uniform2iv (int32_t _idElem,
int32_t _nbElement,
const int32_t* _value);
+ void uniform3iv (int32_t _idElem,
int32_t _nbElement,
const int32_t* _value);
+ void uniform4iv (int32_t _idElem,
int32_t _nbElement,
const int32_t* _value);
+ void uniform2 (int32_t _idElem,
const vec2 & _value);
+ void uniform3 (int32_t _idElem,
const vec3 & _value);
+ void uniform4 (int32_t _idElem,
const vec4 & _value);
+ void uniform2 (int32_t _idElem,
const ivec2 & _value);
+ void uniform3 (int32_t _idElem,
const ivec3 & _value);
+ void uniform4 (int32_t _idElem,
const ivec4 & _value);
+ void use ();
+ void setTexture0 (int32_t _idElem,
GLint _textureOpenGlID);
+ void setTexture1 (int32_t _idElem,
GLint _textureOpenGlID);
+ void unUse ();
+ void updateContext ();
+ void removeContext ();
+ void removeContextToLate ();
+ void reload ();

Object Hierarchy:

+std::enable_shared_from_this<Object>
+ewol::object::ParameterList
+ewol::object::SignalList
+--> +ewol::Object
+--> +ewol::Resource
+--> ewol::resource::Program

Detail:

Program

#  Program ();
Contructor of an opengl Program.


init

# void init (const std::string & _filename);



DECLARE_RESOURCE_NAMED_FACTORY

+  DECLARE_RESOURCE_NAMED_FACTORY (Program );



~Program

+ virtual  ~Program ();
Destructor, remove the current Program.


getAttribute

+ int32_t getAttribute (std::string _elementName);
User request an attribute on this program.
Note: The attribute is send to the fragment shaders


sendAttribute

+ void sendAttribute (int32_t _idElem,
int32_t _nbElement,
const void* _pointer,
int32_t _jumpBetweenSample);
Send attribute table to the spefified ID attribure (not send if does not really exist in the openGL program).


sendAttributePointer

+ void sendAttributePointer (int32_t _idElem,
int32_t _nbElement,
const
std::shared_ptr<ewol::resource::VirtualBufferObject> & _vbo,
int32_t _index,
int32_t _jumpBetweenSample,
int32_t _offset);



sendAttribute

+ void sendAttribute (int32_t _idElem,
const
std::vector<vec2> & _data);



sendAttribute

+ void sendAttribute (int32_t _idElem,
const
std::vector<vec3> & _data);



sendAttribute

+ void sendAttribute (int32_t _idElem,
const
std::vector<etk::Color<float>> & _data);



sendAttribute

+ void sendAttribute (int32_t _idElem,
const
std::vector<float> & _data);



getUniform

+ int32_t getUniform (std::string _elementName);
User request an Uniform on this program.
Note: uniform value is availlable for all the fragment shader in the program (only one value for all)


uniformMatrix4fv

+ void uniformMatrix4fv (int32_t _idElem,
int32_t _nbElement,
mat4 _pointer,
bool _transpose);
Send a uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform

+ void uniform (int32_t _idElem,
const
etk::Color<float> & _value);



uniform1f

+ void uniform1f (int32_t _idElem,
float _value1);
Send 1 float uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform2f

+ void uniform2f (int32_t _idElem,
float _value1,
float _value2);
Send 2 float uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform3f

+ void uniform3f (int32_t _idElem,
float _value1,
float _value2,
float _value3);
Send 3 float uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform4f

+ void uniform4f (int32_t _idElem,
float _value1,
float _value2,
float _value3,
float _value4);
Send 4 float uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform1i

+ void uniform1i (int32_t _idElem,
int32_t _value1);
Send 1 signed integer uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform2i

+ void uniform2i (int32_t _idElem,
int32_t _value1,
int32_t _value2);
Send 2 signed integer uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform3i

+ void uniform3i (int32_t _idElem,
int32_t _value1,
int32_t _value2,
int32_t _value3);
Send 3 signed integer uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform4i

+ void uniform4i (int32_t _idElem,
int32_t _value1,
int32_t _value2,
int32_t _value3,
int32_t _value4);
Send 4 signed integer uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform1fv

+ void uniform1fv (int32_t _idElem,
int32_t _nbElement,
const float* _value);
Send "vec1" uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform2fv

+ void uniform2fv (int32_t _idElem,
int32_t _nbElement,
const float* _value);
Send "vec2" uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform3fv

+ void uniform3fv (int32_t _idElem,
int32_t _nbElement,
const float* _value);
Send "vec3" uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform4fv

+ void uniform4fv (int32_t _idElem,
int32_t _nbElement,
const float* _value);
Send "vec4" uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform1iv

+ void uniform1iv (int32_t _idElem,
int32_t _nbElement,
const int32_t* _value);
Send "ivec1" uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform2iv

+ void uniform2iv (int32_t _idElem,
int32_t _nbElement,
const int32_t* _value);
Send "ivec2" uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform3iv

+ void uniform3iv (int32_t _idElem,
int32_t _nbElement,
const int32_t* _value);
Send "ivec3" uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform4iv

+ void uniform4iv (int32_t _idElem,
int32_t _nbElement,
const int32_t* _value);
Send "ivec4" uniform element to the spefified ID (not send if does not really exist in the openGL program)


uniform2

+ void uniform2 (int32_t _idElem,
const vec2 & _value);



uniform3

+ void uniform3 (int32_t _idElem,
const vec3 & _value);



uniform4

+ void uniform4 (int32_t _idElem,
const vec4 & _value);



uniform2

+ void uniform2 (int32_t _idElem,
const ivec2 & _value);



uniform3

+ void uniform3 (int32_t _idElem,
const ivec3 & _value);



uniform4

+ void uniform4 (int32_t _idElem,
const ivec4 & _value);



use

+ void use ();
Request the processing of this program


setTexture0

+ void setTexture0 (int32_t _idElem,
GLint _textureOpenGlID);
set the testure Id on the specify uniform element.


setTexture1

+ void setTexture1 (int32_t _idElem,
GLint _textureOpenGlID);



unUse

+ void unUse ();
Stop the processing of this program


updateContext

+ void updateContext ();
This load/reload the data in the opengl context, needed when removed previously.


removeContext

+ void removeContext ();
remove the data from the opengl context.


removeContextToLate

+ void removeContextToLate ();
Special android spec! It inform us that all context is removed and after notify us...


reload

+ void reload ();
Relode the shader from the file. used when a request of resouces reload is done.
Note: this is really usefull when we tested the new themes or shader developpements.