Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2012-11-10 15:55:45 +0400
committerTon Roosendaal <ton@blender.org>2012-11-10 15:55:45 +0400
commit4121e4b7e7420bfafe218da501162c8eae22a158 (patch)
treea3ec177e1cc7e3d31bd5716c008085a657448c4f
parent250109f5ace8471451a6d8bda8f67ffc955eb4b7 (diff)
Added UI support to set OpenGL MultiSample.
Code to support it was lying around for long already, but not controlled by UI nicely. Now you have in user preferences "System" tab an option to set it. NOTE: - it only works saving as User startup.blend, and restart Blender. - your system should support it, no check for it is visible in UI - tested only on iMac OSX 10.7 Screenshot: http://www.blender.org/bf/chinchilla.blend.png
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py1
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c16
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h15
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c17
-rw-r--r--source/blender/windowmanager/intern/wm_window.c3
5 files changed, 40 insertions, 12 deletions
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index c5a0a851fc5..3c426ade54b 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -446,6 +446,7 @@ class USERPREF_PT_system(Panel):
#~ col.prop(system, "use_antialiasing")
col.label(text="Window Draw Method:")
col.prop(system, "window_draw_method", text="")
+ col.prop(system, "ogl_multisamples", text="")
col.label(text="Text Draw Options:")
col.prop(system, "use_text_antialiasing")
col.label(text="Textures:")
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index db74179b569..24fc6adae6d 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2985,10 +2985,10 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
v3d->zbuf = FALSE;
/* enables anti-aliasing for 3D view drawing */
-#if 0
- if (!(U.gameflags & USER_DISABLE_AA))
- glEnable(GL_MULTISAMPLE_ARB);
-#endif
+ if (U.ogl_multisamples)
+ if (!(U.gameflags & USER_DISABLE_AA))
+ glEnable(GL_MULTISAMPLE_ARB);
+
/* needs to be done always, gridview is adjusted in drawgrid() now */
rv3d->gridview = v3d->grid;
@@ -3101,12 +3101,12 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
BIF_draw_manipulator(C);
-#if 0
/* Disable back anti-aliasing */
- if (!(U.gameflags & USER_DISABLE_AA))
- glDisable(GL_MULTISAMPLE_ARB);
-#endif
+ if (U.ogl_multisamples)
+ if (!(U.gameflags & USER_DISABLE_AA))
+ glDisable(GL_MULTISAMPLE_ARB);
+
if (v3d->zbuf) {
v3d->zbuf = FALSE;
glDisable(GL_DEPTH_TEST);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index caa7c880aee..69e67461a56 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -418,9 +418,11 @@ typedef struct UserDef {
float ndof_sensitivity; /* overall sensitivity of 3D mouse */
float ndof_orbit_sensitivity;
- float pad4;
int ndof_flag; /* flags for 3D mouse */
+ short ogl_multisamples; /* amount of samples for OpenGL FSA, if zero no FSA */
+ short pad4;
+
float glalphaclip;
short autokey_mode; /* autokeying mode */
@@ -703,6 +705,17 @@ typedef enum eCompute_Device_Type {
USER_COMPUTE_DEVICE_CUDA = 2,
} eCompute_Device_Type;
+
+typedef enum eMultiSample_Type {
+ USER_MULTISAMPLE_NONE = 0,
+ USER_MULTISAMPLE_2 = 2,
+ USER_MULTISAMPLE_4 = 4,
+ USER_MULTISAMPLE_8 = 8,
+ USER_MULTISAMPLE_16 = 16,
+} eMultiSample_Type;
+
+
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 13219ea133d..3e9f5b44a3d 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3018,6 +3018,15 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem multi_sample_levels[] = {
+ {USER_MULTISAMPLE_NONE, "MULTISAMPLE_NONE", 0, "No MultiSample", "Do not use OpenGL MultiSample"},
+ {USER_MULTISAMPLE_2, "MULTISAMPLE_2", 0, "MultiSample: 2", "Use 2x OpenGL MultiSample (requires restart)"},
+ {USER_MULTISAMPLE_4, "MULTISAMPLE_4", 0, "MultiSample: 4", "Use 4x OpenGL MultiSample (requires restart)"},
+ {USER_MULTISAMPLE_8, "MULTISAMPLE_8", 0, "MultiSample: 8", "Use 8x OpenGL MultiSample (requires restart)"},
+ {USER_MULTISAMPLE_16, "MULTISAMPLE_16", 0, "MultiSample: 16", "Use 16x OpenGL MultiSample (requires restart)"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
#if 0
/* hardcoded here, could become dynamic somehow */
/* locale according to http://www.roseindia.net/tutorials/I18N/locales-list.shtml */
@@ -3312,6 +3321,12 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Text Anti-aliasing", "Draw user interface text anti-aliased");
RNA_def_property_update(prop, 0, "rna_userdef_text_update");
+ /* Full scene anti-aliasing */
+ prop = RNA_def_property(srna, "ogl_multisamples", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "ogl_multisamples");
+ RNA_def_property_enum_items(prop, multi_sample_levels);
+ RNA_def_property_ui_text(prop, "MultiSample", "Enable OpenGL multi-sampling, only for systems that support it, requires restart");
+
#ifdef WITH_CYCLES
prop = RNA_def_property(srna, "compute_device_type", PROP_ENUM, PROP_NONE);
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
@@ -3441,7 +3456,7 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_SHOW_GUIDE);
RNA_def_property_ui_text(prop, "Show Navigation Guide", "Display the center and axis during rotation");
/* TODO: update description when fly-mode visuals are in place ("projected position in fly mode")*/
-
+
/* 3D view */
prop = RNA_def_property(srna, "ndof_view_rotate_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "ndof_flag");
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 616567e8184..87d80402af6 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -345,7 +345,7 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win)
(GHOST_TWindowState)win->windowstate,
GHOST_kDrawingContextTypeOpenGL,
0 /* no stereo */,
- 0 /* no AA */);
+ U.ogl_multisamples /* AA */);
if (ghostwin) {
/* needed so we can detect the graphics card below */
@@ -373,7 +373,6 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win)
/* standard state vars for window */
glEnable(GL_SCISSOR_TEST);
-
GPU_state_init();
}
}