Skip to content

Instantly share code, notes, and snippets.

@wakita
Created November 18, 2015 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wakita/5b1588e362343145ece7 to your computer and use it in GitHub Desktop.
Save wakita/5b1588e362343145ece7 to your computer and use it in GitHub Desktop.
qtgl-glfuncs-simplified
void GLWidget::initializeGL() {
QSurfaceFormat fmt = QOpenGLContext::currentContext()->format();
qWarning("OpenGL %d.%d %s", fmt.version().first, fmt.version().second, profile_str[fmt.profile()].c_str());
initializeOpenGLFunctions();
}
#include "mainwindow.hxx"
#include <QApplication>
#include <QSurfaceFormat>
#include <QOpenGLContext>
#include <iostream>
#include <map>
extern Ui::MainWindow mainWindow;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSurfaceFormat fmt;
fmt.setMajorVersion(4); fmt.setMinorVersion(5);
fmt.setProfile(QSurfaceFormat::CoreProfile);
fmt.setSamples(4);
fmt.setDepthBufferSize(24);
QSurfaceFormat::setDefaultFormat(fmt);
MainWindow *w = new MainWindow;
w->show();
return a.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment