summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-06 00:20:21 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-06 00:20:21 +0000
commit229fd6f36d590e04a669087958e1db861925c28a (patch)
tree33b279f86e4ab0396db6ef1f9c8d8dc7b4837523 /src/resources
parent6bb4f7c0a2df49fdba514a2a65236c1ac2367ff9 (diff)
downloadmana-229fd6f36d590e04a669087958e1db861925c28a.tar.gz
mana-229fd6f36d590e04a669087958e1db861925c28a.tar.bz2
mana-229fd6f36d590e04a669087958e1db861925c28a.tar.xz
mana-229fd6f36d590e04a669087958e1db861925c28a.zip
Implemented alpha blending of Images for OpenGL
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/image.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 84723619..989666f2 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -158,6 +158,7 @@ Image* Image::load(const std::string &filePath, int flags)
0, GL_RGBA, GL_UNSIGNED_BYTE,
realData);
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -311,8 +312,8 @@ bool Image::draw(SDL_Surface *screen, int srcX, int srcY, int dstX, int dstY,
float texX2 = (srcX + width) / (float)texWidth;
float texY2 = (srcY + height) / (float)texHeight;
+ glColor4f(1.0f, 1.0f, 1.0f, alpha);
glBindTexture(GL_TEXTURE_2D, image);
-
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
@@ -469,8 +470,8 @@ bool SubImage::draw(SDL_Surface *screen, int srcX, int srcY,
float texX2 = (rect.x + srcX + width) / (float)texWidth;
float texY2 = (rect.y + srcY + height) / (float)texHeight;
+ glColor4f(1.0f, 1.0f, 1.0f, alpha);
glBindTexture(GL_TEXTURE_2D, image);
-
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);