Expose has_extension to query whether OpenGL extension is supported

This commit is contained in:
rdb 2015-01-24 21:55:57 +01:00
parent 0f1243230d
commit a7d1eb90c5
5 changed files with 33 additions and 22 deletions

View File

@ -2972,6 +2972,18 @@ make_shadow_buffer(const NodePath &light_np, GraphicsOutputBase *host) {
return tex;
}
////////////////////////////////////////////////////////////////////
// Function: GraphicsStateGuardian::has_extension
// Access: Public, Virtual
// Description: Returns true if the GSG implements the extension
// identified by the given string. This currently
// is only implemented by the OpenGL back-end.
////////////////////////////////////////////////////////////////////
bool GraphicsStateGuardian::
has_extension(const string &extension) const {
return false;
}
////////////////////////////////////////////////////////////////////
// Function: GraphicsStateGuardian::get_driver_vendor
// Access: Public, Virtual

View File

@ -201,6 +201,7 @@ PUBLISHED:
#endif
PUBLISHED:
virtual bool has_extension(const string &extension) const;
virtual string get_driver_vendor();
virtual string get_driver_renderer();

View File

@ -171,6 +171,25 @@ maybe_gl_finish() const {
#endif
}
////////////////////////////////////////////////////////////////////
// Function: GLGraphicsStateGuardian::has_extension
// Access: Published, Final
// Description: Returns true if the indicated extension is reported
// by the GL system, false otherwise. The extension
// name is case-sensitive.
////////////////////////////////////////////////////////////////////
INLINE bool CLP(GraphicsStateGuardian)::
has_extension(const string &extension) const {
bool has_ext = (_extensions.find(extension) != _extensions.end());
#ifndef NDEBUG
if (GLCAT.is_debug()) {
GLCAT.debug()
<< "HAS EXT " << extension << " " << has_ext << "\n";
}
#endif
return has_ext;
}
////////////////////////////////////////////////////////////////////
// Function: GLGraphicsStateGuardian::is_at_least_gl_version
// Access: Public

View File

@ -6781,27 +6781,6 @@ report_extensions() const {
}
}
////////////////////////////////////////////////////////////////////
// Function: GLGraphicsStateGuardian::has_extension
// Access: Protected
// Description: Returns true if the indicated extension is reported
// by the GL system, false otherwise. The extension
// name is case-sensitive.
////////////////////////////////////////////////////////////////////
bool CLP(GraphicsStateGuardian)::
has_extension(const string &extension) const {
bool state;
state = _extensions.find(extension) != _extensions.end();
if (GLCAT.is_debug()) {
GLCAT.debug()
<< "HAS EXT " << extension << " " << state << "\n";
}
return state;
}
////////////////////////////////////////////////////////////////////
// Function: GLGraphicsStateGuardian::get_extension_func
// Access: Public

View File

@ -406,7 +406,7 @@ protected:
void save_extensions(const char *extensions);
virtual void get_extra_extensions();
void report_extensions() const;
bool has_extension(const string &extension) const;
INLINE virtual bool has_extension(const string &extension) const FINAL;
INLINE bool is_at_least_gl_version(int major_version, int minor_version) const;
INLINE bool is_at_least_gles_version(int major_version, int minor_version) const;
void *get_extension_func(const char *name);