I just want to make a full screen game. I know how to change resolution on Windows but how do I change the resolution under Linux? Is there a cross platform QT solution for this? Also I've got borders around my GLWidget. How do I make the widget cover the entire window?
I'm just going to post the code:
#include <QtOpenGL> class GLWidget : public QGLWidget { public: void initializeGL() { glClearColor(0.0f, 0.0f, 1.0f, 0.0f); glClearDepth(1.0f); } void paintGL() { glClear(GL_COLOR_BUFFER_BIT); } void resizeGL(int width, int height) { int side = qMin(width, height); glViewport((width - side) / 2, (height - side) / 2, side, side); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-0.5f, +0.5f, -0.5f, +0.5f, 4.0f, 15.0f); glMatrixMode(GL_MODELVIEW); } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); QDesktopWidget *desktop = app.desktop(); QWidget window; GLWidget *glWidget = new GLWidget; QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->addWidget(glWidget); window.setLayout(mainLayout); window.setWindowTitle("Hello GL"); window.resize(QSize(640, 480)); window.show(); window.showFullScreen(); return app.exec(); }