diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2011-10-24 23:16:57 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-10-24 23:16:57 (GMT) |
| commit | 506ab6ea0ea88c14a279ef31b715d2e8e1e7f358 (patch) | |
| tree | fb86ad7f3d1f4507fbdfd22eda83cac052cac93e /src | |
| parent | 1171a23353f9ba4d9619a61b17594b9c6bd9c13e (diff) | |
| download | powder-506ab6ea0ea88c14a279ef31b715d2e8e1e7f358.zip powder-506ab6ea0ea88c14a279ef31b715d2e8e1e7f358.tar.gz | |
Cursors for OpenGL, Coords are a bit off, which is annoying and I cannot draw to parts FBO because It's already been rendered D:<
Diffstat (limited to 'src')
| -rw-r--r-- | src/graphics.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/src/graphics.c b/src/graphics.c index c52fb1b..ffcf385 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -3102,12 +3102,13 @@ void render_zoom(pixel *img) //draws the zoom box glTexCoord2d(zcx1, zcy0); glVertex3f(zoom_wx+ZSIZE*ZFACTOR, YRES+MENUSIZE-zoom_wy, 1.0); glEnd(); + glBindTexture(GL_TEXTURE_2D, 0); glDisable( GL_TEXTURE_2D ); if(zoom_en) { - //glEnable(GL_COLOR_LOGIC_OP); + glEnable(GL_COLOR_LOGIC_OP); //glEnable(GL_LINE_SMOOTH); glLogicOp(GL_XOR); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); @@ -3118,7 +3119,7 @@ void render_zoom(pixel *img) //draws the zoom box glVertex3i(zoom_x+ZSIZE, YRES+MENUSIZE-(zoom_y-1), 0); glVertex3i(zoom_x-1, YRES+MENUSIZE-(zoom_y-1), 0); glEnd(); - //glDisable(GL_COLOR_LOGIC_OP); + glDisable(GL_COLOR_LOGIC_OP); } #else int x, y, i, j; @@ -3432,6 +3433,41 @@ corrupt: //draws the cursor void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry) { +#ifdef OGLR + int i; + if (t<PT_NUM||(t&0xFF)==PT_LIFE||t==SPC_AIR||t==SPC_HEAT||t==SPC_COOL||t==SPC_VACUUM||t==SPC_WIND||t==SPC_PGRV||t==SPC_NGRV) + { + glEnable(GL_COLOR_LOGIC_OP); + glLogicOp(GL_XOR); + glBegin(GL_LINE_LOOP); + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + if (CURRENT_BRUSH==SQUARE_BRUSH) + { + glVertex2f(x-rx+1, (YRES+MENUSIZE-y)-ry+1); + glVertex2f(x+rx+1, (YRES+MENUSIZE-y)-ry+1); + glVertex2f(x+rx+1, (YRES+MENUSIZE-y)+ry+1); + glVertex2f(x-rx+1, (YRES+MENUSIZE-y)+ry+1); + glVertex2f(x-rx+1, (YRES+MENUSIZE-y)-ry+1); + } + else if (CURRENT_BRUSH==CIRCLE_BRUSH) + { + for (i = 0; i < 360; i++) + { + float degInRad = i*(M_PI/180.0f); + glVertex2f((cos(degInRad)*rx)+x, (sin(degInRad)*ry)+YRES+MENUSIZE-y); + } + } + else if (CURRENT_BRUSH==TRI_BRUSH) + { + glVertex2f(x+1, (YRES+MENUSIZE-y)+ry+1); + glVertex2f(x+rx+1, (YRES+MENUSIZE-y)-ry+1); + glVertex2f(x-rx+1, (YRES+MENUSIZE-y)-ry+1); + glVertex2f(x+1, (YRES+MENUSIZE-y)+ry+1); + } + glEnd(); + glDisable(GL_COLOR_LOGIC_OP); + } +#else int i,j,c; if (t<PT_NUM||(t&0xFF)==PT_LIFE||t==SPC_AIR||t==SPC_HEAT||t==SPC_COOL||t==SPC_VACUUM||t==SPC_WIND||t==SPC_PGRV||t==SPC_NGRV) { @@ -3504,6 +3540,7 @@ void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry) xor_pixel(x+CELL+c-1, y+i, vid); } } +#endif } int sdl_open(void) |
