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
5
votes
2 answers

QGLWidget - Cross section of 3-D hollow objects

I'm using QGLWidget to draw 3-D objects, the input to my program is the faces of the shapes. Meaning that when I want to draw a cube, I got list of 6 elements each one represent a face and each face contain 4 points, (x,y,z) for each point. The…
Mahmoud Hassan
  • 572
  • 1
  • 3
  • 13
5
votes
4 answers

How to take reliable QGLWidget snapshot

In my application I take snapshots of a QGLWidget's contents for two purposes: Not redraw the scene all the time when only an overlay changes, using a cached pixmap instead Lat the user take screenshots of the particular plots (3D scene) The first…
ypnos
  • 45,954
  • 14
  • 88
  • 130
4
votes
3 answers

QGLWidget appears black in Windows 7

I wrote and tested some code in a Windows XP (Qt 4.7.2) using Visual Studio 2010 and then I tried on another machine with Windows 7 installed. The program opens a QDialog and creates a QGLWidget where I show webcam images (with some processing).…
sergi
  • 137
  • 1
  • 3
  • 12
4
votes
1 answer

QGLWidget don't move its contents on scroll

I'm using Qt from python with PySide bindings. The main part of my application is the OpenGL view that can be resized to particular value (this is a simulator for testing my game in different resolutions of mobile devices). I use QGLWidget to render…
Vavius
  • 208
  • 2
  • 6
4
votes
1 answer

Widgets with transparent backgrounds over a QGraphicsView with a QGLWidget viewport

I recently tried setting the viewport of my QGraphicsView to a QGLWidget to see how it performs. What I noticed is that widgets which previously had transparent backgrounds (styled buttons, in-game menus that have no background) now have black…
Mitch
  • 21,360
  • 9
  • 67
  • 104
4
votes
1 answer

OpenSceneGraph and Multiple Viewers

I'm using OpenSceneGraph and Qt to develop a simulation software. Simulations can involve multiple bots in the same virtual world. My requirements for views are as follows: Ability to show static world cameras Ability to show bot cameras Ability to…
kelano
  • 273
  • 3
  • 13
4
votes
5 answers

calling Qt's QGraphicsView::setViewport with a custom QGLWidget

I've derived from QGLWidget before, like so: class MyGLWidget : public QGLWidget { public: // stuff... virtual void initializeGL() { /* my custom OpenGL initialization routine */ } // more stuff... }; However, I find that if I try to…
moswald
  • 10,845
  • 4
  • 47
  • 74
3
votes
1 answer

How to flip a texture within beginNativePainting()?

I'm writing a class that inherits from QGLWidget: class GLWidget : public QGLWidget { Q_OBJECT public: GLWidget(QWidget *parent = 0); ~GLWidget(); void paintEvent(QPaintEvent *event); private: QImage* _frame; }; The…
karlphillip
  • 87,606
  • 33
  • 227
  • 395
3
votes
1 answer

QWidget showFullScreen produces multiple resizeEvents

I have a QT application written in python using PySide and I stumbled across a little problem regarding the showFullScreen method of the QGLWidget (although the problem occurs with every other widget too): The problem is, that the widget doesn't…
Chris
  • 1,573
  • 1
  • 14
  • 27
3
votes
0 answers

Qt QGLWidget OpenGL rendering from thread blocks on swapBuffers()

I have a strange problem rendering OpenGL to QGLWidget from a different thread than the main thread. There are a lot of official statements from Qt Developers that it is "perfectly possible" to do rendering from a different thread. I followed the…
DyingSoul
  • 221
  • 3
  • 11
3
votes
4 answers

Problems compiling an c++ application using QT and OpenGL

I'm following this tutorial for building a simple OpenGl application in C++ using QT. I'm trying to compile the application using g++ and the command line but I get the following errors: /tmp/ccH2KFoZ.o: In function…
slayton
  • 19,732
  • 8
  • 57
  • 86
3
votes
1 answer

add button on the top of the qglwidget

I add a toolbutton on the top of my qglwidget. The icon image of the toolbutton is round except the transparent edge.But after coding and showing the widget, the side of the buttong is black. my result What work should I do to make the edge…
Joe
  • 31
  • 4
3
votes
2 answers

Using a QGLWidget as the viewport for QGraphicsView results in black screen

I have a QGraphicsView displaying a QGraphicsScene which I would like to use a QGLWidget as the viewport for. The Qt documentation leads me to believe that it is a simple as giving my QGraphicsScene a QGLWidget as a viewport, however I get a black…
Chris
  • 544
  • 6
  • 21
3
votes
0 answers

Does QPainter in QGLWidget use GPU?

Do QPainter's APIs in QGLWidget use GPU? Or only use CPU to paint but put the result of QPainter to OpenGL's texture ?(just like draw in texture) After some google, I see that there are some people said that Qt would translate QPainter's api to…
reiko
  • 85
  • 6
3
votes
1 answer

OpenGL application looks weird after porting to Qt5

I recently ported my engine from QGLWidget to QWindow. Everything works nice, except texturing. They appear with a lot of holes, dark and really weird. Example to show what I mean: (Broken build (QWindow)) Second example: (Working build…
Nazar554
  • 3,745
  • 3
  • 24
  • 34
1
2
3
12 13