glgsg: don't call glLineWidth with higher value than maximum
Officially, in core profile OpenGL 3.2+, calling it with a value higher than 1.0 is an error, but many vendors seem to let us. Apple's implementation does not. It appears that checking the maximum line width is a way to deal with this. Fixes #466
This commit is contained in:
parent
301957c591
commit
3c6b6e47ec
|
|
@ -771,6 +771,28 @@ reset() {
|
|||
_supported_geom_rendering |= Geom::GR_point_sprite;
|
||||
}
|
||||
|
||||
// Determine whether we support wide lines (and how wide they can be).
|
||||
{
|
||||
GLfloat aliased_range[2] = {1.0f, 1.0f};
|
||||
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, aliased_range);
|
||||
|
||||
_max_line_width = aliased_range[1];
|
||||
|
||||
#ifdef SUPPORT_FIXED_FUNCTION
|
||||
if (has_fixed_function_pipeline()) {
|
||||
#ifndef OPENGLES
|
||||
GLfloat range[2] = {1.0f, 1.0f};
|
||||
glGetFloatv(GL_LINE_WIDTH_RANGE, range);
|
||||
_max_line_width = std::max(_max_line_width, range[1]);
|
||||
#endif
|
||||
|
||||
GLfloat smooth_range[2] = {1.0f, 1.0f};
|
||||
glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, smooth_range);
|
||||
_max_line_width = std::max(_max_line_width, smooth_range[1]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef OPENGLES_1
|
||||
// OpenGL ES 1.0 does not support primitive restart indices.
|
||||
|
||||
|
|
@ -7352,7 +7374,7 @@ do_issue_render_mode() {
|
|||
GLCAT.spam() << "setting thickness to " << thickness << "\n";
|
||||
}
|
||||
|
||||
glLineWidth(thickness);
|
||||
glLineWidth(std::min(thickness, _max_line_width));
|
||||
#ifndef OPENGLES_2
|
||||
glPointSize(thickness);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -685,6 +685,8 @@ protected:
|
|||
#endif
|
||||
#endif
|
||||
|
||||
GLfloat _max_line_width;
|
||||
|
||||
#ifdef HAVE_CG
|
||||
CGcontext _cg_context;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue