Working around vertex array problem

This commit is contained in:
Josh Yelon 2007-07-12 00:36:32 +00:00
parent 278fe85c1a
commit 51ef307c21
3 changed files with 29 additions and 13 deletions

View File

@ -102,6 +102,16 @@ get_gl_renderer() const {
return _gl_renderer;
}
////////////////////////////////////////////////////////////////////
// Function: CLP(GraphicsStateGuardian)::get_gl_version
// Access: Public
// Description: Returns the GL version string reported by the driver.
////////////////////////////////////////////////////////////////////
INLINE const string &CLP(GraphicsStateGuardian)::
get_gl_version() const {
return _gl_version;
}
////////////////////////////////////////////////////////////////////
// Function: CLP(GraphicsStateGuardian)::get_gl_version_major
// Access: Public

View File

@ -571,6 +571,17 @@ reset() {
_supports_multitexture = false;
_supports_vertex_arrays = true;
if (_gl_version == "1.2 (1.5 Mesa 6.4.2)") {
// We suspect this particular version of Mesa, which appears to
// be installed by default on every Linux implementation, has
// real problems rendering with vertex arrays. Therefore,
// disable vertex arrays by default.
GLCAT.debug()
<< "Buggy Mesa version detected; vertex array support is doubted.\n";
_supports_vertex_arrays = false;
}
_supports_tex_non_pow2 =
has_extension("GL_ARB_texture_non_power_of_two");
@ -1702,6 +1713,9 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader,
// extra vertex arrays used by the previous rendering mode.
#ifdef SUPPORT_IMMEDIATE_MODE
_use_sender = !vertex_arrays;
if (!_supports_vertex_arrays) {
_use_sender = true;
}
#endif
if (_vertex_array_shader_context==0) {
if (_current_shader_context==0) {
@ -4325,6 +4339,7 @@ void CLP(GraphicsStateGuardian)::
query_gl_version() {
_gl_vendor = show_gl_string("GL_VENDOR", GL_VENDOR);
_gl_renderer = show_gl_string("GL_RENDERER", GL_RENDERER);
_gl_version = show_gl_string("GL_VERSION", GL_VERSION);
_gl_version_major = 0;
_gl_version_minor = 0;
@ -4361,18 +4376,6 @@ query_gl_version() {
<< _gl_version_major << "." << _gl_version_minor
<< "." << _gl_version_release << "\n";
}
if (version == "1.2 (1.5 Mesa 6.4.2)") {
// We suspect this particular version of Mesa, which appears to
// be installed by default on every Linux implementation, has
// real problems rendering with vertex arrays. Therefore,
// disable vertex arrays by default.
GLCAT.debug()
<< "Buggy Mesa version detected; vertex array support is doubted.\n";
if (!vertex_arrays.has_value()) {
load_prc_file_data("mesa-hack", "vertex-arrays 0");
}
}
}
}

View File

@ -195,6 +195,7 @@ public:
INLINE const string &get_gl_vendor() const;
INLINE const string &get_gl_renderer() const;
INLINE const string &get_gl_version() const;
INLINE int get_gl_version_major() const;
INLINE int get_gl_version_minor() const;
INLINE int get_gl_version_release() const;
@ -386,6 +387,7 @@ protected:
string _gl_vendor;
string _gl_renderer;
string _gl_version;
int _gl_version_major, _gl_version_minor, _gl_version_release;
pset<string> _extensions;
@ -421,7 +423,8 @@ public:
bool _supports_bgr;
bool _supports_rescale_normal;
bool _supports_vertex_arrays;
bool _supports_multitexture;
PFNGLACTIVETEXTUREPROC _glActiveTexture;
PFNGLCLIENTACTIVETEXTUREPROC _glClientActiveTexture;