Skip to content

Instantly share code, notes, and snippets.

@wakita

wakita/glwidget.cxx

Created Nov 18, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.