summaryrefslogtreecommitdiff
path: root/src/graphics/OpenGLDrawMethods.inl
diff options
context:
space:
mode:
authorBryan Hoyle <starfoxprime@gmail.com>2012-08-12 20:32:28 (GMT)
committer Bryan Hoyle <starfoxprime@gmail.com>2012-08-12 20:32:28 (GMT)
commit98d31ab5a5ee69e097ec1e47e38d4d940ed64331 (patch)
tree522b836b8b2ca7858b7d04eb3fd44fea589e5102 /src/graphics/OpenGLDrawMethods.inl
parentf9a59d22dbd2e28ed39c92032eaf2ad397521416 (diff)
downloadpowder-98d31ab5a5ee69e097ec1e47e38d4d940ed64331.zip
powder-98d31ab5a5ee69e097ec1e47e38d4d940ed64331.tar.gz
Fixed brush for now, used inefficient algorithm until I can get pure opengl working
Diffstat (limited to 'src/graphics/OpenGLDrawMethods.inl')
-rw-r--r--src/graphics/OpenGLDrawMethods.inl16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/graphics/OpenGLDrawMethods.inl b/src/graphics/OpenGLDrawMethods.inl
index 37f3002..fb443e9 100644
--- a/src/graphics/OpenGLDrawMethods.inl
+++ b/src/graphics/OpenGLDrawMethods.inl
@@ -214,6 +214,7 @@ void PIXELMETHODS_CLASS::xor_rect(int x, int y, int width, int height)
void PIXELMETHODS_CLASS::xor_bitmap(unsigned char * bitmap, int x, int y, int w, int h)
{
+ /* Rewriting until better method can be found
//glEnable(GL_COLOR_LOGIC_OP);
//glLogicOp(GL_XOR);
glEnable(GL_TEXTURE_2D);
@@ -222,8 +223,7 @@ void PIXELMETHODS_CLASS::xor_bitmap(unsigned char * bitmap, int x, int y, int w,
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_ALPHA, GL_UNSIGNED_BYTE, bitmap);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_ALPHA, GL_UNSIGNED_BYTE, bitmap);
glBegin(GL_QUADS);
glTexCoord2d(0, 0);
@@ -239,6 +239,18 @@ void PIXELMETHODS_CLASS::xor_bitmap(unsigned char * bitmap, int x, int y, int w,
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
//glDisable(GL_COLOR_LOGIC_OP);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+ */
+ glColor4f(1.0f,1.0f,1.0f,1.0f);
+ for(int i =0; i < w*h; i++)
+ {
+ if(bitmap[i]==255)
+ {
+ glBegin(GL_POINTS);
+ glVertex2f(x+i%w,y+i/w);
+ glEnd();
+ }
+ }
}
void PIXELMETHODS_CLASS::draw_line(int x, int y, int x2, int y2, int r, int g, int b, int a)