本文整理汇总了C++中GLWidget::initializeGL方法的典型用法代码示例。如果您正苦于以下问题:C++ GLWidget::initializeGL方法的具体用法?C++ GLWidget::initializeGL怎么用?C++ GLWidget::initializeGL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLWidget
的用法示例。
在下文中一共展示了GLWidget::initializeGL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isValidVersion
bool OpenGLVersionChecker::isValidVersion() {
bool valid = true;
// Retrieve OpenGL version
GLWidget* glWidget = new GLWidget();
glWidget->initializeGL();
QString glVersion = QString((const char*)glGetString(GL_VERSION));
delete glWidget;
// Compare against minimum
// The GL_VERSION string begins with a version number in one of these forms:
// - major_number.minor_number
// - major_number.minor_number.release_number
// Reference: https://www.opengl.org/sdk/docs/man/docbook4/xhtml/glGetString.xml
QStringList versionParts = glVersion.split(QRegularExpression("[\\.\\s]"));
int majorNumber = versionParts[0].toInt();
int minorNumber = versionParts[1].toInt();
int minimumMajorNumber = GPU_CORE_MINIMUM / 100;
int minimumMinorNumber = (GPU_CORE_MINIMUM - minimumMajorNumber * 100) / 10;
valid = (majorNumber > minimumMajorNumber
|| (majorNumber == minimumMajorNumber && minorNumber >= minimumMinorNumber));
// Prompt user if below minimum
if (!valid) {
QMessageBox messageBox;
messageBox.setWindowTitle("OpenGL Version Too Low");
messageBox.setIcon(QMessageBox::Warning);
messageBox.setText(QString().sprintf("Your OpenGL version of %i.%i is lower than the minimum of %i.%i.",
majorNumber, minorNumber, minimumMajorNumber, minimumMinorNumber));
messageBox.setInformativeText("Press OK to exit; Ignore to continue.");
messageBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Ignore);
messageBox.setDefaultButton(QMessageBox::Ok);
valid = messageBox.exec() == QMessageBox::Ignore;
}
return valid;
}