{
texture = texture_manager->get(file);
texture->ref();
- uv_left = 0.5 / texture->get_width();
- uv_top = 0.5 / texture->get_height();
+ uv_left = 0;
+ uv_top = 0;
uv_right = texture->get_uv_right();
uv_bottom = texture->get_uv_bottom();
float tex_w = static_cast<float> (texture->get_width());
float tex_h = static_cast<float> (texture->get_height());
- uv_left = static_cast<float>(x+0.5) / tex_w;
- uv_top = static_cast<float>(y+0.5) / tex_h;
- uv_right = static_cast<float>(x+w-0.5) / tex_w;
- uv_bottom = static_cast<float>(y+h-0.5) / tex_h;
+ uv_left = static_cast<float>(x) / tex_w;
+ uv_top = static_cast<float>(y) / tex_h;
+ uv_right = static_cast<float>(x+w) / tex_w;
+ uv_bottom = static_cast<float>(y+h) / tex_h;
width = w;
height = h;
static inline void intern_draw2(float left, float top, float right, float bottom,
float uv_left, float uv_top,
float uv_right, float uv_bottom,
- float angle,
+ float angle, float alpha,
const Color& color,
const Blend& blend,
DrawingEffect effect)
bottom -= center_y;
glBlendFunc(blend.sfactor, blend.dfactor);
- glColor4f(color.red, color.green, color.blue, color.alpha);
+ glColor4f(color.red, color.green, color.blue, color.alpha * alpha);
glBegin(GL_QUADS);
glTexCoord2f(uv_left, uv_top);
glVertex2f(left*ca - top*sa + center_x,
void
Surface::draw(float x, float y, float alpha, float angle, const Color& color, const Blend& blend, DrawingEffect effect) const
{
- glColor4f(1.0f, 1.0f, 1.0f, alpha);
glBindTexture(GL_TEXTURE_2D, texture->get_handle());
intern_draw2(x, y,
x + width, y + height,
uv_left, uv_top, uv_right, uv_bottom,
angle,
+ alpha,
color,
blend,
effect);
void
Surface::draw(float x, float y, float alpha, DrawingEffect effect) const
{
- glColor4f(1.0f, 1.0f, 1.0f, alpha);
glBindTexture(GL_TEXTURE_2D, texture->get_handle());
+ glColor4f(1, 1, 1, alpha);
intern_draw(x, y,
x + width, y + height,
uv_left, uv_top, uv_right, uv_bottom, effect);
+ glColor4f(1, 1, 1, 1);
}
void
float uv_right = this->uv_left + (uv_width * (src_x + width)) / this->width;
float uv_bottom = this->uv_top + (uv_height * (src_y + height)) / this->height;
- glColor4f(1.0f, 1.0f, 1.0f, alpha);
glBindTexture(GL_TEXTURE_2D, texture->get_handle());
+ glColor4f(1, 1, 1, alpha);
intern_draw(dst_x, dst_y,
dst_x + width, dst_y + height,
uv_left, uv_top, uv_right, uv_bottom, effect);
+ glColor4f(1, 1, 1, 1);
}