force initial antialias state; enable multisample when transparency requires it

This commit is contained in:
David Rose 2005-01-27 04:37:43 +00:00
parent 3826171dbe
commit 1064603147
2 changed files with 19 additions and 2 deletions

View File

@ -94,9 +94,11 @@ enable_multisample(bool val) {
if (val) { if (val) {
GLP(Enable)(GL_MULTISAMPLE); GLP(Enable)(GL_MULTISAMPLE);
} else { } else {
if (!_multisample_alpha_one_enabled && !_multisample_alpha_mask_enabled) {
GLP(Disable)(GL_MULTISAMPLE); GLP(Disable)(GL_MULTISAMPLE);
} }
} }
}
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -262,8 +264,12 @@ enable_multisample_alpha_one(bool val) {
_multisample_alpha_one_enabled = val; _multisample_alpha_one_enabled = val;
if (val) { if (val) {
GLP(Enable)(GL_SAMPLE_ALPHA_TO_ONE); GLP(Enable)(GL_SAMPLE_ALPHA_TO_ONE);
GLP(Enable)(GL_MULTISAMPLE);
} else { } else {
GLP(Disable)(GL_SAMPLE_ALPHA_TO_ONE); GLP(Disable)(GL_SAMPLE_ALPHA_TO_ONE);
if (!_multisample_enabled) {
GLP(Disable)(GL_MULTISAMPLE);
}
} }
} }
} }
@ -280,8 +286,12 @@ enable_multisample_alpha_mask(bool val) {
_multisample_alpha_mask_enabled = val; _multisample_alpha_mask_enabled = val;
if (val) { if (val) {
GLP(Enable)(GL_SAMPLE_ALPHA_TO_COVERAGE); GLP(Enable)(GL_SAMPLE_ALPHA_TO_COVERAGE);
GLP(Enable)(GL_MULTISAMPLE);
} else { } else {
GLP(Disable)(GL_SAMPLE_ALPHA_TO_COVERAGE); GLP(Disable)(GL_SAMPLE_ALPHA_TO_COVERAGE);
if (!_multisample_enabled) {
GLP(Disable)(GL_MULTISAMPLE);
}
} }
} }
} }

View File

@ -438,8 +438,15 @@ reset() {
_buffer_mask &= ~RenderBuffer::T_back; _buffer_mask &= ~RenderBuffer::T_back;
} }
// Set up the specific state values to GL's known initial values. // Ensure the initial state is what we say it should be (in some
// cases, we don't want the GL default settings; in others, we have
// to force the point with some drivers that aren't strictly
// compliant w.r.t. initial settings).
GLP(FrontFace)(GL_CCW); GLP(FrontFace)(GL_CCW);
GLP(Disable)(GL_MULTISAMPLE);
GLP(Disable)(GL_LINE_SMOOTH);
GLP(Disable)(GL_POINT_SMOOTH);
GLP(Disable)(GL_POLYGON_SMOOTH);
// Set up all the enabled/disabled flags to GL's known initial // Set up all the enabled/disabled flags to GL's known initial
// values: everything off. // values: everything off.