summaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-15 14:02:48 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-15 14:02:48 (GMT)
commit2f0e67433c624cd3e006ca3f789e36edc64a894f (patch)
tree99a988ffe38f9cfd472e0252ded2ae4af2c156dc /src/graphics
parent0bb4c0e57acabb956a4a0718ebab14364b6063f9 (diff)
downloadpowder-2f0e67433c624cd3e006ca3f789e36edc64a894f.zip
powder-2f0e67433c624cd3e006ca3f789e36edc64a894f.tar.gz
Ensure zoom is drawn after particles for OpenGL Rendering, draw walls onto the correct framebuffer
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/OpenGLDrawMethods.inl8
-rw-r--r--src/graphics/Renderer.cpp65
2 files changed, 52 insertions, 21 deletions
diff --git a/src/graphics/OpenGLDrawMethods.inl b/src/graphics/OpenGLDrawMethods.inl
index 173cb4b..02e0378 100644
--- a/src/graphics/OpenGLDrawMethods.inl
+++ b/src/graphics/OpenGLDrawMethods.inl
@@ -228,7 +228,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
+ /* Rewriting until better method can be found */
//glEnable(GL_COLOR_LOGIC_OP);
//glLogicOp(GL_XOR);
glEnable(GL_TEXTURE_2D);
@@ -254,8 +254,8 @@ void PIXELMETHODS_CLASS::xor_bitmap(unsigned char * bitmap, int x, int y, int w,
glDisable(GL_TEXTURE_2D);
//glDisable(GL_COLOR_LOGIC_OP);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
- */
- float old_size;
+
+ /*float old_size;
glGetFloatv(GL_POINT_SIZE,&old_size);
glPointSize(1.0);
@@ -269,7 +269,7 @@ void PIXELMETHODS_CLASS::xor_bitmap(unsigned char * bitmap, int x, int y, int w,
}
}
glEnd();
- glPointSize(old_size);
+ glPointSize(old_size);*/
}
void PIXELMETHODS_CLASS::draw_line(int x, int y, int x2, int y2, int r, int g, int b, int a)
diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp
index 399661d..a2261f8 100644
--- a/src/graphics/Renderer.cpp
+++ b/src/graphics/Renderer.cpp
@@ -47,10 +47,10 @@ void Renderer::RenderBegin()
std::fill(warpVid, warpVid+(VIDXRES*VIDYRES), 0);
}
#endif
- draw_air();
- draw_grav();
+ //draw_air();
+ //draw_grav();
render_parts();
- render_fire();
+ //render_fire();
#ifndef OGLR
if(display_mode & DISPLAY_PERS)
{
@@ -71,8 +71,8 @@ void Renderer::RenderBegin()
}
#endif
DrawWalls();
- draw_grav_zones();
- DrawSigns();
+ //draw_grav_zones();
+ //DrawSigns();
#ifndef OGLR
if(display_mode & DISPLAY_WARP)
{
@@ -86,10 +86,17 @@ void Renderer::RenderBegin()
void Renderer::RenderEnd()
{
- RenderZoom();
#ifdef OGLI
+#ifdef OGLR
+ FinaliseParts();
+ RenderZoom();
+#else
+ RenderZoom();
FinaliseParts();
#endif
+#else
+ RenderZoom();
+#endif
}
void Renderer::clearScreen(float alpha)
@@ -341,7 +348,7 @@ void Renderer::RenderZoom()
glGetIntegerv(GL_BLEND_SRC, &origBlendSrc);
glGetIntegerv(GL_BLEND_DST, &origBlendDst);
- glBlendFunc(GL_ONE, GL_ZERO);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);//glBlendFunc(GL_ONE, GL_ZERO);
glEnable( GL_TEXTURE_2D );
//glReadBuffer(GL_AUX0);
@@ -576,6 +583,39 @@ VideoBuffer * Renderer::WallIcon(int wallID, int width, int height)
void Renderer::DrawWalls()
{
+#ifdef OGLR
+ GLint prevFbo;
+ glGetIntegerv(GL_FRAMEBUFFER_BINDING, &prevFbo);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, partsFbo);
+ glTranslated(0, MENUSIZE, 0);
+
+ int x, y, i, j, cr, cg, cb;
+ unsigned char wt;
+ pixel pc;
+ pixel gc;
+ unsigned char (*bmap)[XRES/CELL] = sim->bmap;
+ unsigned char (*emap)[XRES/CELL] = sim->emap;
+ wall_type *wtypes = sim->wtypes;
+ for (y=0; y<YRES/CELL; y++)
+ for (x=0; x<XRES/CELL; x++)
+ if (bmap[y][x])
+ {
+ wt = bmap[y][x];
+ if (wt<0 || wt>=UI_WALLCOUNT)
+ continue;
+ pc = wtypes[wt].colour;
+ gc = wtypes[wt].eglow;
+
+ cr = PIXR(pc);
+ cg = PIXG(pc);
+ cb = PIXB(pc);
+
+ fillrect(x*CELL, y*CELL, CELL, CELL, cr, cg, cb, 255);
+ }
+
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, prevFbo);
+ glTranslated(0, -MENUSIZE, 0);
+#else
int x, y, i, j, cr, cg, cb;
unsigned char wt;
pixel pc;
@@ -592,13 +632,6 @@ void Renderer::DrawWalls()
continue;
pc = wtypes[wt].colour;
gc = wtypes[wt].eglow;
-#ifdef OGLR
- int r = PIXR(pc);
- int g = PIXG(pc);
- int b = PIXB(pc);
- int a = 255;
-#endif
-#ifndef OGLR
// standard wall patterns
if (wtypes[wt].drawstyle==1)
@@ -714,10 +747,8 @@ void Renderer::DrawWalls()
fire_b[y][x] = cb;
}
-#else
- this->fillrect(x*CELL, y*CELL, CELL, CELL, r, g, b, a);
-#endif
}
+#endif
}
void Renderer::DrawSigns()