9 #ifndef __rag__Renderer__
10 #define __rag__Renderer__
12 #include <rag/Platform.h>
15 #include "RenderTarget.h"
19 #define renderer rag::Renderer::getInstance()
34 bool usesTexCoordArray;
53 enum EMaterialAttributes
81 void bindColorArray(
void* array,
int channels = 4,
int stride = 0);
98 void bindBuffer(
int target,
int buffer);
100 void createVertexBuffer(GLuint& vboID);
101 void deleteVertexBuffer(GLuint& vboID);
128 const Shader& getShader(
const std::string& path, GLenum shaderType);
129 GLuint compileShader(
const std::string& path, GLenum shaderType);
131 void useProgram(
const Program& program);
132 void setUniform(
const char* name,
float value);
133 void setUniform(
const char* name,
float x,
float y);
134 void setUniform(
const char* name,
float x,
float y,
float z);
135 void setUniform(
const char* name,
float x,
float y,
float z,
float w);
136 void setUniformMatrix3(
const char* name,
float* mtx);
137 void setUniformMatrix4(
const char* name,
float* mtx);
139 std::vector<Program> programs;
140 std::map<std::string, Shader> shaders;
143 GLenum blendSource, blendDest;
145 bool vertexArrayEnabled;
146 bool texCoordArrayEnabled;
147 bool colorArrayEnabled;
Contains methods to render objects.
Definition: Renderer.h:49
std::string fsh
Path to the fragment shader.
Definition: Renderer.h:28
glm::mat4 getOrthoProjection()
Returns an orthographic projection.
Definition: Renderer.cpp:155
void setClearColor(Color color)
Set clear color.
Definition: Renderer.cpp:65
void bindTextureArray(void *array, int size=2, int stride=0)
Binds a texture array that would be used for the next draw call.
Definition: Renderer.cpp:264
int bindMaterial(rag::Material *material)
Binds the Material to be used in the next draw call.
Definition: Renderer.cpp:289
GLuint handle
Internal GL handle.
Definition: Renderer.h:29
std::string vsh
Path to the vertex shader.
Definition: Renderer.h:27
void precompileShader(const std::string &path)
Precomiples a Shader, useful to call it in loading times.
Definition: Renderer.cpp:70
Object where DisplayObject instances with render capability are suposed to render.
Definition: RenderTarget.h:44
int loadProgram(const char *vsh, const char *fsh)
Loads and starts using a program with the given shaders.
Definition: Renderer.cpp:95
void bindColorArray(void *array, int channels=4, int stride=0)
Binds a color array that would be used for the next draw call.
Definition: Renderer.cpp:269
Represents a render material that would affect how objects will be rendered.
Definition: Material.h:39
void checkError()
Displays an error if something's wrong.
Definition: Renderer.cpp:375
int getCurrentProgramHandle()
Returns the handle of the program used currently.
Definition: Renderer.cpp:370
void setBlendFunc(GLenum source, GLenum dest)
Sets blending function.
Definition: Renderer.cpp:279
void clearShaders()
Forget shaders and programs loaded. Programs will be generated again as needed.
Definition: Renderer.cpp:425
Represents a GL Shader.
Definition: Renderer.h:38
rag::RenderTarget & getRenderTarget()
TODO Pass render target as parameter to render() method in DisplayObject - so that it becomes more ob...
Definition: Renderer.h:119
Represents RGBA color.
Definition: Color.h:11
Represents a Shader Program.
Definition: Renderer.h:25
void bindTexture(int textureName)
Binds a texture by id.
Definition: Renderer.cpp:274
void bindVertexArray(void *array, int size=2, int stride=0)
Binds a vertex array that would be used for the next draw call.
Definition: Renderer.cpp:259