Fix click-selection in the editor for OpenGL implementations that insist on point blending

This commit is contained in:
Chris Taylor 2013-01-17 12:45:42 +08:00
parent 1eb70135fe
commit e0b97f5b56
2 changed files with 19 additions and 7 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20130117
--------
main/render.c: Fix click-selection in the editor for OpenGL implementations that insist on point blending
20130112
--------
arch/carbon/conf.h: Used new D1XMAJORi / D1XMINORi / D1XMICROi version constants for Mac

View file

@ -486,13 +486,21 @@ void render_object_search(object *obj)
//what color the object draws in, so we try color 0, then color 1,
//in case the object itself is rendering color 0
gr_setcolor(0);
gr_setcolor(0); //set our search pixel to color zero
#ifdef OGL
ogl_end_frame();
#endif
gr_pixel(_search_x,_search_y); //set our search pixel to color zero
#ifdef OGL
// For OpenGL we use gr_rect instead of gr_pixel,
// because in some implementations (like my Macbook Pro 5,1)
// point smoothing can't be turned off.
// Point smoothing would change the pixel to dark grey, but it MUST be black.
// Making a 3x3 rectangle wouldn't matter
// (but it only seems to draw a single pixel anyway)
gr_rect(_search_x - 1, _search_y - 1, _search_x + 1, _search_y + 1);
ogl_start_frame();
#else
gr_pixel(_search_x,_search_y);
#endif
render_object(obj);
if (gr_ugpixel(&grd_curcanv->cv_bitmap,_search_x,_search_y) != 0)
@ -501,10 +509,10 @@ void render_object_search(object *obj)
gr_setcolor(1);
#ifdef OGL
ogl_end_frame();
#endif
gr_pixel(_search_x,_search_y); //set our search pixel to color zero
#ifdef OGL
gr_rect(_search_x - 1, _search_y - 1, _search_x + 1, _search_y + 1);
ogl_start_frame();
#else
gr_pixel(_search_x,_search_y);
#endif
render_object(obj);
if (gr_ugpixel(&grd_curcanv->cv_bitmap,_search_x,_search_y) != 1)