OpenGL anti-aliasing for 3D view, user selectable

Enables AA only for 3D view, and gives the user the option to turn it on/off (in system panel of user prefs)
This commit is contained in:
Damien Plisson 2010-01-07 10:32:48 +00:00
parent cf9b728c6a
commit f0a22ac2f9
5 changed files with 15 additions and 1 deletions

@ -411,6 +411,7 @@ class USERPREF_PT_system(bpy.types.Panel):
col.prop(system, "clip_alpha", slider=True)
col.prop(system, "use_mipmaps")
col.prop(system, "use_vbos")
col.prop(system, "use_antialiasing")
col.label(text="Window Draw Method:")
col.row().prop(system, "window_draw_method", expand=True)
col.label(text="Textures:")

@ -2040,6 +2040,10 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
Object *obact = OBACT;
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 */
v3d->customdata_mask= get_viewedit_datamask(CTX_wm_screen(C), scene, obact);
@ -2222,6 +2226,10 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
/* XXX here was the blockhandlers for floating panels */
v3d->flag |= V3D_INVALID_BACKBUF;
/* Disable back anti-aliasing */
if (!(U.gameflags & USER_DISABLE_AA))
glDisable(GL_MULTISAMPLE_ARB);
}

@ -468,6 +468,7 @@ extern UserDef U; /* from blenkernel blender.c */
#define USER_DISABLE_SOUND 2
#define USER_DISABLE_MIPMAP 4
#define USER_DISABLE_VBO 8
#define USER_DISABLE_AA 16
/* wm draw method */
#define USER_DRAW_TRIPLE 0

@ -2212,6 +2212,10 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_VBO);
RNA_def_property_ui_text(prop, "VBOs", "Use Vertex Buffer Objects (or Vertex Arrays, if unsupported) for viewport rendering.");
prop= RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_AA);
RNA_def_property_ui_text(prop, "Anti-aliasing", "Use anti-aliasing for the 3D view (may impact redraw performance)");
prop= RNA_def_property(srna, "gl_texture_limit", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "glreslimit");
RNA_def_property_enum_items(prop, gl_texture_clamp_items);

@ -313,7 +313,7 @@ static void wm_window_add_ghostwindow(wmWindowManager *wm, char *title, wmWindow
inital_state,
GHOST_kDrawingContextTypeOpenGL,
0 /* no stereo */,
0 /* no AA */);
4 /* 4x AA */);
if (ghostwin) {