Commit d5cc556b authored by Jan Möbius's avatar Jan Möbius

Added Postprocessor interface function to check OpenGL capabilities

Return if Renderer or Postprocessor has insufficient OpenGL capabilities

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17544 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e764c8d1
......@@ -106,6 +106,42 @@ class PostProcessorInterface {
*/
virtual QAction* optionsAction() { return 0; };
private slots:
/** \brief Check OpenGL capabilities
*
* This function has to be implemented and checks, if all required OpenGL extensions are available.
* If this is not the case, the plugin will be refused by the core to avoid crashes due to insufficient
* OpenGL support.
*
* You can get the version information in the following way:
*
* \code
*
* // Get version and check
* QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
* if ( ! flags.testFlag(QGLFormat::OpenGL_Version_2_1) )
* return QString("Insufficient OpenGL Version! OpenGL 2.1 or higher required");
*
* //Get OpenGL extensions
* QString glExtensions = QString((const char*)glGetString(GL_EXTENSIONS));
*
* // Collect missing extension
* QString missing = "";
*
* if ( !glExtensions.contains("GL_ARB_vertex_buffer_object") )
* missing += "Missing Extension GL_ARB_vertex_buffer_object\n";
*
* if ( !glExtensions.contains("GL_ARB_vertex_program") )
* missing += "Missing Extension GL_ARB_vertex_program\n";
*
* return missing;
* \endcode
*
* @return Return an empty string if everything is fine, otherwise return, what features are missing.
*/
virtual QString checkOpenGL() = 0;
};
/** \page postProcessorInterfacePage Post Processor Interface
......
......@@ -1975,8 +1975,9 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
QMetaObject::invokeMethod(plugin,"checkOpenGL", Qt::DirectConnection, Q_RETURN_ARG(QString,openGLCheck) ) ;
if ( openGLCheck != "" ) {
emit log(LOGERR,tr("Error: Insufficient OpenGL capabilities in Plugin") + rendererNameString + " !");
emit log(LOGERR,tr("Error: Insufficient OpenGL capabilities in Renderer Plugin ") + rendererNameString + " !");
emit log(LOGERR,openGLCheck);
return;
}
// Check if it already exists and add it if not.
......@@ -1987,9 +1988,6 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
emit log(LOGERR,tr("Error: Renderer Plugin %1 already exists").arg(rendererNameString));
}
// Retrieve and store renderer information
if ( rendererInfo != 0) {
rendererInfo->plugin = renderPlugin;
......@@ -2030,6 +2028,16 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
// Get the name of the PostProcessor
QMetaObject::invokeMethod(plugin,"postProcessorName", Qt::DirectConnection, Q_RETURN_ARG(QString,postProcessorNameString) ) ;
// Let the plugin check its OpenGL support requirements
QString openGLCheck = "";
QMetaObject::invokeMethod(plugin,"checkOpenGL", Qt::DirectConnection, Q_RETURN_ARG(QString,openGLCheck) ) ;
if ( openGLCheck != "" ) {
emit log(LOGERR,tr("Error: Insufficient OpenGL capabilities in post processor Plugin ") + postProcessorNameString + " !");
emit log(LOGERR,openGLCheck);
return;
}
// Check if it already exists and add it if not.
PostProcessorInfo* postProcessorInfo = 0;
if ( ! postProcessorManager().postProcessorExists(postProcessorNameString) ) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment