FSAA: properly disable it for first window draw, remove obsolete backbuffer

disable code, and only enable it for 3d drawing in the 3d view.
This commit is contained in:
Brecht Van Lommel 2010-01-08 09:30:36 +00:00
parent b8ca67ca33
commit ccb54eff2e
2 changed files with 10 additions and 32 deletions

@ -1096,16 +1096,6 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
struct Base *base = scene->basact; struct Base *base = scene->basact;
rcti winrct; rcti winrct;
/*for 2.43 release, don't use glext and just define the constant.
this to avoid possibly breaking platforms before release.*/
#ifndef GL_MULTISAMPLE_ARB
#define GL_MULTISAMPLE_ARB 0x809D
#endif
#ifdef GL_MULTISAMPLE_ARB
int m;
#endif
if(base && (base->object->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT) || if(base && (base->object->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT) ||
paint_facesel_test(base->object))); paint_facesel_test(base->object)));
else if((base && (base->object->mode & OB_MODE_TEXTURE_PAINT)) && else if((base && (base->object->mode & OB_MODE_TEXTURE_PAINT)) &&
@ -1126,16 +1116,6 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
// } // }
// } // }
/* Disable FSAA for backbuffer selection.
Only works if GL_MULTISAMPLE_ARB is defined by the header
file, which is should be for every OS that supports FSAA.*/
#ifdef GL_MULTISAMPLE_ARB
m = glIsEnabled(GL_MULTISAMPLE_ARB);
if (m) glDisable(GL_MULTISAMPLE_ARB);
#endif
if(v3d->drawtype > OB_WIRE) v3d->zbuf= TRUE; if(v3d->drawtype > OB_WIRE) v3d->zbuf= TRUE;
glDisable(GL_DITHER); glDisable(GL_DITHER);
@ -1172,10 +1152,6 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
if(rv3d->rflag & RV3D_CLIPPING) if(rv3d->rflag & RV3D_CLIPPING)
view3d_clr_clipping(); view3d_clr_clipping();
#ifdef GL_MULTISAMPLE_ARB
if (m) glEnable(GL_MULTISAMPLE_ARB);
#endif
/* it is important to end a view in a transform compatible with buttons */ /* it is important to end a view in a transform compatible with buttons */
// persp(PERSP_WIN); // set ortho // persp(PERSP_WIN); // set ortho
@ -2040,10 +2016,6 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
Object *obact = OBACT; Object *obact = OBACT;
char *grid_unit= NULL; char *grid_unit= NULL;
/* enables anti-aliasing for 3D view drawing */
if (!(U.gameflags & USER_DISABLE_AA))
glEnable(GL_MULTISAMPLE_ARB);
/* from now on all object derived meshes check this */ /* from now on all object derived meshes check this */
v3d->customdata_mask= get_viewedit_datamask(CTX_wm_screen(C), scene, obact); v3d->customdata_mask= get_viewedit_datamask(CTX_wm_screen(C), scene, obact);
@ -2070,6 +2042,10 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
else else
v3d->zbuf= FALSE; v3d->zbuf= FALSE;
/* enables anti-aliasing for 3D view drawing */
if (!(U.gameflags & USER_DISABLE_AA))
glEnable(GL_MULTISAMPLE_ARB);
// needs to be done always, gridview is adjusted in drawgrid() now // needs to be done always, gridview is adjusted in drawgrid() now
rv3d->gridview= v3d->grid; rv3d->gridview= v3d->grid;
@ -2176,6 +2152,10 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
BIF_draw_manipulator(C); BIF_draw_manipulator(C);
/* Disable back anti-aliasing */
if (!(U.gameflags & USER_DISABLE_AA))
glDisable(GL_MULTISAMPLE_ARB);
if(v3d->zbuf) { if(v3d->zbuf) {
v3d->zbuf= FALSE; v3d->zbuf= FALSE;
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
@ -2226,10 +2206,6 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
/* XXX here was the blockhandlers for floating panels */ /* XXX here was the blockhandlers for floating panels */
v3d->flag |= V3D_INVALID_BACKBUF; v3d->flag |= V3D_INVALID_BACKBUF;
/* Disable back anti-aliasing */
if (!(U.gameflags & USER_DISABLE_AA))
glDisable(GL_MULTISAMPLE_ARB);
} }

@ -1313,6 +1313,8 @@ void GPU_state_init(void)
glFrontFace(GL_CCW); glFrontFace(GL_CCW);
glCullFace(GL_BACK); glCullFace(GL_BACK);
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
glDisable(GL_MULTISAMPLE_ARB);
} }
/* debugging aid */ /* debugging aid */