qglwidget

When is QGLWidget's paintGL called?

吃可爱长大的小学妹 提交于 2019-12-29 07:32:12
问题 All I can find is "whenever the widget needs to be painted." When is that, specifically? 回答1: When you call updateGL() on your widget (or update() ), or just Qt decides to redraw your widget. Reasons why Qt might choose to ask for a redraw include: your widget gets resized your widget is hidden and shown again your widget is minimized and then restored something else is put in front of your widget and then moved away the Moon is in the third quarter a distant butterfly had flapped its wings .

QGLWidget in QScrollArea says “invalid drawable”

有些话、适合烂在心里 提交于 2019-12-24 11:50:17
问题 When I display my QGLWidget in the layout of my main QWidget, everything is fine. When I put the QGLWidget into a QScrollArea, and then display, Python says: 2011-05-14 19:10:28.900 Python[68311:613] invalid drawable 回答1: Making the widget resizable seemed to fix the problem. 来源: https://stackoverflow.com/questions/6005368/qglwidget-in-qscrollarea-says-invalid-drawable

OpenGL Picking on Selection Mode

回眸只為那壹抹淺笑 提交于 2019-12-24 02:55:06
问题 I know that OpenGL selection mode is deprecated and never was HW accelerated, except on a few SGI boxes and 3DLabs GPUs.But i can't get rid of it (not my code).Below its the C++ code: void GLWidget::Selection(int x,int y) // This Is Where Selection Is Done { GLint viewport[4]; glSelectBuffer(BUFSIZE,selectBuf); glRenderMode(GL_SELECT); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glGetIntegerv(GL_VIEWPORT,viewport); gluPickMatrix(x,viewport[3]-y,5,5,viewport); //defining the

How to flip a texture within beginNativePainting()?

时光怂恿深爱的人放手 提交于 2019-12-23 16:09:13
问题 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 constructor of GLWidget loads an image from the disk, and paintEvent() is responsible to send the data to the GPU using native OpenGL calls that are executed between beginNativePainting() and endNativePainting() , and this works OK. The problem is that the image is being

How to share OpenGL context or data?

时间秒杀一切 提交于 2019-12-23 15:39:44
问题 I need to shared data (textures, vertex-buffers,... ) across all OpenGL widgets in a application. The following code isn't working: I've found some solutions that have one main QGLWidget and other are constructed using this main widget. Unfortunately, I can't use this approach, because all my QGLWidgets are equal and almost certainly the first(main) created QGLWidget will be destroyed before others are. Possible approach: single shared OpenGL context between all QGLWidgets not working: just

Strategy for sharing OpenGL resources

戏子无情 提交于 2019-12-22 05:41:17
问题 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 assets (models stored as VBOs) to be shared across each document i.e. the 5 viewports. I thought as long as I shared around the shader program and VBO GLuint addresses all will automagickly work - it doesn't. I think because each viewport/context has

Rendering a OpenCV IplImage to a QGLWidget

南笙酒味 提交于 2019-12-21 23:29:01
问题 I am having trouble with rendering a OpenGL scene. The background is I want to display the frames from a video capture device in a preview window. I am using OpenCV and Qt. And to test I am capturing from my MacBook webcam. The preview window is 200x200 and the frame captured is 640x480. I am not worried about maintaining aspect ratios. Other info from the IplImage struct: Debug: channels: 3 Debug: depth: 8 Debug: dataOrder: 0 Debug: align: 4. Alignment of image rows 4 or 8 Debug: origin: 0.

How to fullscreen a QGLWidget?

心已入冬 提交于 2019-12-19 02:26:54
问题 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 really full-screen, even without the top part where you have the close fullscreen and minimize buttons. I have this program so far: #include <QApplication> int main(int argc, char** argv) { QApplication app(argc, argv); QGLWidget w; w.show(); return

Integrate Qt into prewritten Application/Framework

喜夏-厌秋 提交于 2019-12-14 03:09:41
问题 I have a small visualization framework written in c++ and want to use Qt to have a proper GUI and control over my visualizations to interact with them. currently, I am using GLUT to create a window and draw a view in it. so everything I do is initialize an object of the class Visualization which does everything for me: holding model and views. the view itself holds a controller to process user input and manipulate the model. my main loop looks like this: Visualization* vis = new Visualization

QGLWidget not working correctly under Mac OS X Lion

自闭症网瘾萝莉.ら 提交于 2019-12-13 14:18:26
问题 As you see -- I have no idea why it's not working at all. When the program run, it will look like this: I'm using qt4-mac(v4.8.2) from macports. It seems that the package was pre-compiled. And here's the source: main.cpp: #include <iostream> #include <QApplication> #include "GLPlayerWindow.hpp" int main(int argc, char *argv[]) { QApplication app(argc, argv); GLPlayerWindow window; window.show(); window.resize(800, 600); return app.exec(); } GLPlayerWindow.hpp: #ifndef __GLPLAYERWINDOW__HPP_