![]() |
rag
graphic 2d engine
|
Contains methods to render objects. More...
#include <Renderer.h>
Public Types | |
enum | EMaterialAttributes { ATTRIB_VERTEX = 0, ATTRIB_TEXTURECOORD, ATTRIB_COLOR, ATTRIB_NORMAL, ATTRIB_TANGENT, ATTRIB_BONES_INDICES, ATTRIB_BONES_WEIGHTS, NUM_ATTRIBUTES } |
Public Member Functions | |
void | init () |
int | loadProgram (const char *vsh, const char *fsh) |
Loads and starts using a program with the given shaders. | |
void | bindVertexArray (void *array, int size=2, int stride=0) |
Binds a vertex array that would be used for the next draw call. | |
void | bindTextureArray (void *array, int size=2, int stride=0) |
Binds a texture array that would be used for the next draw call. | |
void | bindColorArray (void *array, int channels=4, int stride=0) |
Binds a color array that would be used for the next draw call. | |
int | bindMaterial (rag::Material *material) |
Binds the Material to be used in the next draw call. More... | |
void | bindTexture (int textureName) |
Binds a texture by id. | |
void | setBlendFunc (GLenum source, GLenum dest) |
Sets blending function. | |
void | setClearColor (Color color) |
Set clear color. | |
void | bindBuffer (int target, int buffer) |
void | createVertexBuffer (GLuint &vboID) |
void | deleteVertexBuffer (GLuint &vboID) |
int | getCurrentProgramHandle () |
Returns the handle of the program used currently. | |
void | checkError () |
Displays an error if something's wrong. | |
void | precompileShader (const std::string &path) |
Precomiples a Shader, useful to call it in loading times. | |
glm::mat4 | getOrthoProjection () |
Returns an orthographic projection. | |
void | clearShaders () |
Forget shaders and programs loaded. Programs will be generated again as needed. | |
rag::RenderTarget & | getRenderTarget () |
TODO Pass render target as parameter to render() method in DisplayObject - so that it becomes more obvious where are you suposed to draw in. | |
Static Public Member Functions | |
static Renderer & | getInstance () |
Contains methods to render objects.
Most of the functionality in this class, is handled like a state machine, like OpenGL does. Setting states would left that states changed until other change is done. This applies for all the bind() functions.
int rag::Renderer::bindMaterial | ( | rag::Material * | material | ) |
Binds the Material to be used in the next draw call.
bindMaterial() changes internal states of the renderer and prepares a context to make the render draw call.