outfit colors

This commit is contained in:
Eduardo Bart
2011-08-19 09:26:26 -03:00
parent 8b2bceaef3
commit c6dd25ed99
9 changed files with 226 additions and 21 deletions

View File

@@ -19,7 +19,6 @@ void Graphics::init()
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glShadeModel(GL_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
logInfo("GPU ", glGetString(GL_RENDERER));
@@ -30,6 +29,7 @@ void Graphics::init()
m_emptyTexture = TexturePtr(new Texture);
bindColor(Color::white);
bindBlendFunc(BLEND_NORMAL);
}
void Graphics::terminate()
@@ -285,6 +285,18 @@ void Graphics::bindTexture(const TexturePtr& texture)
glBindTexture(GL_TEXTURE_2D, texture->getId());
}
void Graphics::bindBlendFunc(BlendFuncType blendType)
{
switch(blendType) {
case BLEND_NORMAL:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
break;
case BLEND_COLORIZING:
glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
break;
}
}
void Graphics::startDrawing()
{
assert(!m_drawing);

View File

@@ -3,6 +3,11 @@
#include "declarations.h"
enum BlendFuncType {
BLEND_NORMAL,
BLEND_COLORIZING
};
class Graphics
{
public:
@@ -29,6 +34,7 @@ public:
void bindColor(const Color& color);
void bindTexture(const TexturePtr& texture);
void bindBlendFunc(BlendFuncType blendType);
// drawing API
void drawTexturedRect(const Rect& screenCoords,