Questions tagged [qglwidget]

The QGLWidget class, part of the Qt framework, is a widget for rendering OpenGL graphics.

QGLWidget provides functionality for displaying OpenGL graphics integrated into a Qt application. It is very simple to use. You inherit from it and use the subclass like any other QWidget, except that you have the choice between using QPainter and standard OpenGL rendering commands.

Note: This class is part of the legacy Qt OpenGL module and, like the other QGL classes, should be avoided in the new applications. Instead, starting from Qt 5.4, prefer using QOpenGLWidget and the QOpenGL classes.

Documentation can be found here (Qt4) and here (Qt5).

186 questions
15
votes
2 answers

Why does QGLWidget only render a blank screen?

I have used OpenGL in SDL before, but I have just started to learn QT. In QT, using OpenGL is proving to be somewhat of a pain. I have the following two files: main.cpp #include #include #include "glwidget.hpp" #include…
William Oliver
  • 1,302
  • 2
  • 23
  • 34
10
votes
1 answer

When is QGLWidget's paintGL called?

All I can find is "whenever the widget needs to be painted." When is that, specifically?
Nomis Raserf
  • 123
  • 1
  • 4
9
votes
2 answers

QGLWidget and hardware acceleration?

Greetings all, Does simply subclassing QGLWidget and reimplementing paintEvent() make use of OpenGL and hardware acceleration? I create a QPainter and draw QImages in this paintEvent(). What happen inside the paintEvent() method of QGLWidget? Does…
Ashika Umanga Umagiliya
  • 7,998
  • 19
  • 86
  • 167
8
votes
2 answers

Hosting QOpenGL widget inside QML

I have a library proving me a QGLWidget, and the interface allow me to only to resize/set size, and control some GL animation; but no GL command is exposed outside, all i do it initialize GLWidget, and then pass the context to library and later call…
P M
  • 817
  • 1
  • 10
  • 17
8
votes
1 answer

OpenCV + OpenGL + Qt

I'm designing my own augmented reality application. I have already detected the 4 corners for the patterns I'm working with. After detecting the 4 corners in a proper order I'm passing them into cvFindExtrinsicCameraParams2. I'm getting nice results…
daleotar
  • 315
  • 3
  • 6
7
votes
1 answer

Qt & OpenGL - QGLWidget & QPainter: depth buffering

I subclass QGLWidget and have my painting code in paintEvent instead of paintGL as I want to paint a 2D overlay using QPainter over my 3D stuff done with OpenGL. My depth buffering works fine when I don't have an overlay. If the overlay is painted,…
user816098
  • 262
  • 2
  • 14
7
votes
2 answers

How to fullscreen a QGLWidget?

I am new to OpenGL and Qt, and I am learning both simultaneously(3 days already:). I couple of years ago I did some exmerimenting with DirectX and I clearly remember that it was possible to make a full-screen window there. By full-screen I mean…
Armen Tsirunyan
  • 120,726
  • 52
  • 304
  • 418
7
votes
1 answer

How to use OpenGL functions on a QT OpenGL Widget?

I'm starting off QT 4.6's example "OpenGL - 2D painting" It uses a subclass of QGLWidget, and makes painting operations with the class QPainter. I'd like to know how to do drawing directly with OpenGL functions on the OpenGL Widget.
Petruza
  • 10,275
  • 24
  • 74
  • 121
6
votes
1 answer

OpenGL rendering to a QML item

I have a QML file which contains a layout of QML items and now I want one of those items to be a QGLWidget. i.e. I want to render to a specific QML item. Is anyone aware of how to do this?
blueskin
  • 8,713
  • 10
  • 67
  • 100
6
votes
1 answer

Strategy for sharing OpenGL resources

I'm creating a CAD-like app (Qt-based), it will be a multiple document interface and each document will contain about 5 viewports (derived from QGLWidget). As such I need my flat shader to be shared across the entire application, and then the 3D…
cmannett85
  • 20,254
  • 7
  • 62
  • 100
6
votes
1 answer

2d HUD not drawing properly over QGLWidget (using QPainter)

I am trying to display HUD over my 3D game. For starters, I am just trying to display "Hello World", but I haven't had any success yet! The scene freezes / flickers once I am done. I am using Qt/C++ and QGLWdiget / QPainter to get this done. I have…
brainydexter
  • 17,648
  • 25
  • 70
  • 108
5
votes
3 answers

How to scale glDrawPixels?

I need to scale the result of glDrawPixels image. I'm drawing a 640x480 pixels image buffer with glDrawPixels in a Qt QGLWidget. I tryed to do the following in PaintGL: glScalef(windowWidth/640, windowHeight/480,…
Hermandroid
  • 1,962
  • 4
  • 27
  • 35
5
votes
1 answer

Sharing OpenGL VAO/VBO/etc. via QGLWidget

I am using a 3 layer hierarchy of QGLWidgets to share shaders and vertex data between 5 OpenGL viewports in my CAD-like app. The root context is used for compiling application-wide shaders, the per document context is used to share model vertex…
cmannett85
  • 20,254
  • 7
  • 62
  • 100
5
votes
5 answers

Undefined reference to vtable, Qt in Linux

I was trying to compile a Qt and OpenGL program under Code::Blocks in Ubuntu 10.04. I get the 'undefined reference to 'vtable for GLWidget' #ifndef _GLWIDGET_H #define _GLWIDGET_H #include #include "stdlib.h" class GLWidget :…
Mores Fre
  • 51
  • 1
  • 2
5
votes
2 answers

3D model (.3ds) in Qt OpenGL widget

I need to load a 3D model (.3ds file) in my QGLWidget (Qt OpenGL widget). I am looking for a cross-platform solution working under Linux, Windows and Mac. I have found some solutions on the web, but still have not been able to integrate any of them…
Mikael
  • 153
  • 2
  • 4
  • 10
1
2 3
12 13