Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. opengl
    Log in to post

    • UNSOLVED Can QT 5.12.x and above version support OpenGL sparse texture feature - ARB_sparse_texture - call glTexPageCommitmentARB()?
      General and Desktop • opengl • • jianlu  

      1
      0
      Votes
      1
      Posts
      16
      Views

      No one has replied

    • UNSOLVED QWindow on a non-GUI thread
      General and Desktop • opengl qwindow threaded • • rtavakko  

      5
      0
      Votes
      5
      Posts
      72
      Views

      @SGaist Thanks! I will play around with that example
    • SOLVED Dynamic Textures in Qt3D with C++
      Game Development • opengl qt3d graphics qt5.15.0 • • Jakob Weiss  

      2
      0
      Votes
      2
      Posts
      74
      Views

      Ok, I figured out how to use updateData properly. Leaving this here for posterity. For my use case, I needed to upload a grayscale 3D texture but this should be the same for any texture type: using namespace Qt3DRender; QTexture * tex = new QTexture3D; tex->setSize(vol.width(), vol.height(), vol.depth()); tex->setFormat(QTexture3D::TextureFormat::R8_UNorm); tex->setLayers(1); tex->setGenerateMipMaps(false); QTextureWrapMode wm(QTextureWrapMode::ClampToBorder); tex->setWrapMode(wm); data->setFormat(QOpenGLTexture::TextureFormat::R8_UNorm); data->setWidth(vol.width()); data->setHeight(vol.height()); data->setDepth(vol.depth()); data->setMipLevels(1); data->setLayers(1); data->setPixelFormat(QOpenGLTexture::PixelFormat::Red); data->setPixelType(QOpenGLTexture::PixelType::UInt8); QByteArray qba; qba.setRawData((const char *)vol.dataUint8(), static_cast<int>(vol.byteSize())); data->setData(qba, 1); QTextureDataUpdate update; update.setX(0); update.setY(0); update.setData(data); tex->updateData(update); Qt3DRender::QParameter p(); p.setName("volume"); // the uniform name in the shader p.setValue(QVariant::fromValue(tex)); QMaterial * mat = ...; // queried from the qml mat->addParameter(p); The Qt3D test for texture update was pretty helpful in figuring this out.
    • UNSOLVED Qt6 opengl/gpu assisted QGraphicsView drawing workflow
      General and Desktop • opengl qgraphicsview vulkan • • Dariusz  

      4
      0
      Votes
      4
      Posts
      34
      Views

      Are you thinking of the new RHI abstraction layer ?
    • UNSOLVED QQuickFramebufferObject with external OpenGL in Qt6
      QML and Qt Quick • opengl qt6 fbo • • mnesarco  

      4
      0
      Votes
      4
      Posts
      56
      Views

      Hi this might be due to the new Qt RHI, an abstraction over OpenGL, Vulkan, Metal, DirectX (might have forgotten some or mentioned some that shouldn't be). Qt Quick will no longer be speaking directly to OpenGL but there will be an abstraction on top of it to ensure compatility with other graphical stacks. You will get more info about this by googling around or watching this webinar : https://www.youtube.com/watch?v=eInD6H4XrpM
    • SOLVED Retrive QML's QOpenGL context
      QML and Qt Quick • opengl context-sharing • • ebatsin  

      2
      0
      Votes
      2
      Posts
      54
      Views

      @ebatsin is your QQuickItem in a QQuickWindow? I guess it is the case if you are not using a QQuickWidget. Calling QQuickWindow::openglContext() on your item's window should give you what you need.
    • UNSOLVED Is there a way to refresh some part of QGraphicsScene
      General and Desktop • opengl qgraphicsscene • • aminM  

      1
      0
      Votes
      1
      Posts
      58
      Views

      No one has replied

    • UNSOLVED QtQuick3D:How to customize geometry data and update it in real time?
      QML and Qt Quick • opengl render quick3d • • FinchX  

      5
      0
      Votes
      5
      Posts
      152
      Views

      @oria66 see https://github.com/qt/qtquick3d/blob/14b434d12786ab1b6b90dabb38b0fe4001e54c6a/tests/auto/quick3d/qquick3dgeometry/tst_qquick3dgeometry.cpp
    • SOLVED QOpenGLWidget::update() stops working after a while
      General and Desktop • opengl qopenglwidget qt 5.14 • • Ulysse  

      4
      0
      Votes
      4
      Posts
      104
      Views

      You should not call GUI function from a different thread. Signal and slots is the way to go.
    • SOLVED Where is surface "shininess" specified in these shaders?
      General and Desktop • opengl datavisualizati glshaders • • Tom asso  

      3
      0
      Votes
      3
      Posts
      55
      Views

      Yup, looks like you've spotted it -- in particular, the specular term is materialSpecularColor * lightStrength * pow(cosAlpha, 10) That's the part that will contribute to the shininess of the material. And, materialSpecularColor comes from highp vec3 materialSpecularColor = lightColor.rgb; which is to say that the materialSpecularColor in that shader is not really a property of the material since the value is just from the lighting. Not really the clearest name if you are trying to pick it apart. This type of look is traditionally used for a plastic type material which has white highlights for white lights regardless of the color of the material. If you want something a bit more metallic looking, you can multiply the lightcolor.rgb by some actual material color. This lighting model is a bit of an old school aphysical hack, so you may want to look into to more modern physically based lighting models if you are looking for more realism. But the classic specular + diffuse model is way simpler to understand even if it isn't super accurate to the real world.
    • SOLVED application can't be displayed on embedded platform
      Mobile and Embedded • qml opengl cross compile embedded qt quick 2d ren • • Kechieh_wang  

      8
      0
      Votes
      8
      Posts
      115
      Views

      @sierdzio Ok, i see, I'm using open source. Maybe I need to change a deviece or try to use qwidget. Thanks for your patience.
    • UNSOLVED Rendering issue in QOpenGLWindow
      General and Desktop • opengl • • Julius Aetherwing  

      3
      0
      Votes
      3
      Posts
      57
      Views

      @Julius-Aetherwing Sorry, I'm not familiar with OpenGL, too. But you can find some example code in Qt install dir, something like "C:\Qt\Examples\Qt-5.12.6\opengl" The docs of the examples can be found in All Qt Examples
    • SOLVED Poor quality colored emojis, how to fix that?
      QML and Qt Quick • opengl rendering emoji low quality colored • • jeanmilost  

      8
      0
      Votes
      8
      Posts
      277
      Views

      @fcarney said in Poor quality colored emojis, how to fix that?: font.hintingPreference: Font.PreferNoHinting Wow excellent! This resolved my issue. Thank you very much
    • UNSOLVED Problem with glBindTexture
      General and Desktop • opengl qopengl qopengltexture bind • • FrankE  

      2
      0
      Votes
      2
      Posts
      182
      Views

      That's becoming even more weird: GLFunctions::gl30()->glGenTextures(1, &texHandle); returns 2 in texHandle. but for using it in the shader it works for a value of 1 in the bindTexture GLFunctions::gl30()->glBindTexture(GL_TEXTURE_2D, texHandle-1); This is driving me nuts.
    • UNSOLVED How to display gpumat image in opengl widget
      General and Desktop • opengl qt 5.14 opencv cpp cuda nvidia • • Imran B  

      4
      0
      Votes
      4
      Posts
      145
      Views

      What processing are you doing with OpenCV ?
    • UNSOLVED From QWidget + QPainter to QOpenGLWidget + QPainter
      General and Desktop • opengl qt 5.6 • • Ulysse  

      4
      0
      Votes
      4
      Posts
      108
      Views

      For those who end up looking here : It seems that this is a Qt 5.6 bug, it works fine in Qt 5.14 Edit : The bug itself may be related to the use of QSurfaceFormat::setDefaultFormat after application startup : Qt 5.14 warned me about a piece of code I was not aware saying that it could cause context sharing issues. Having it removed seems to have solved the bug when i got back to Qt 5.6
    • SOLVED Qt5 opengl widget givng error openglfunctions line 656
      General and Desktop • opengl widget opengl es 3.0 • • gtx0908  

      5
      0
      Votes
      5
      Posts
      107
      Views

      @Chris-Kawa ah ok that worked and learned something new thanks
    • UNSOLVED Adding a QOpenGLWidget to a QWindow greatly impacts its performance
      General and Desktop • opengl performance 5.12.7 • • Makutik  

      3
      0
      Votes
      3
      Posts
      160
      Views

      Thanks, so that is what "OpenGL-based composing" does under the hood! Is there any way to synchronize/batch my QGraphicsView updates, so that there is less of a performance impact? Or would it be preferable to switch the QGraphicsView-based widgets over to render their scene via OpenGL?
    • UNSOLVED QOpenGLWidget VSync
      General and Desktop • opengl qopenglcontext vsync framerate • • rtavakko  

      22
      0
      Votes
      22
      Posts
      942
      Views

      @mcleary @Patterson Its been a long time since this thread was started but I think it makes sense to post the updates here. I put together a basic project with native OpenGL and also using Qt's QOffscreenSurface and QWindow classes. The github repository can be found here: https://github.com/rtavakko/VSync In this setup there is a single renderer that render to an FBO texture using its own thread and 3 display windows that share the GUI thread with all of them sharing OpenGL contexts together. On my machine I see a clear lag with VSync on when there are 2 or more display windows. Turning VSync off clears the lag. The calcualted FPS values do not indicate any issues in either case which doesn't help but I see a clear difference when I start the application with say 2 displays and then close one of them. I have my internal laptop display and an RCA RT1970 (both running at 1920x1080 - 60Hz) and both connected to my integrated Intel HD 530 GPU. My discrete GPU is an NVIDIA GeForce GTX 950M and I'm running Qt 5.12.0 MSVC2017 64 bit. I'll dig in further myself also with other machines but if anyone has any ideas on what could be causing this, it would really help debug further. Cheers!
    • UNSOLVED How to draw image faster
      General and Desktop • opengl windows 10 qt5.9 • • yijia  

      2
      0
      Votes
      2
      Posts
      106
      Views

      @yijia Maybe with different QLabel and QPixmap or QPicture https://doc.qt.io/qt-5/qlabel.html#pixmap-prop https://doc.qt.io/qt-5/qlabel.html#setPicture
    • SOLVED QOpenGLWidget and Multiple Textures
      General and Desktop • opengl qopenglwidget image processin shaders glsl • • rtavakko  

      2
      0
      Votes
      2
      Posts
      382
      Views

      Alright after developing spine problems from leaning into my screen for a week and losing more hair than my GPU has cores, I sort of fixed the issue. So for some reason when I was reading data into my textures without setting the active texture back to the GL_TEXTURE0 default, things were going sideways. So basically I had something like: glActiveTexture(GL_TEXTURE0 + inputTextureUnit[vid]); glBindTexture(GL_TEXTURE_2D, inputTextureID[vid]); glTexImage2D(GL_TEXTURE_2D, 0, GL_internalFormat[vid], videoSpecs[vid].videoWidth, videoSpecs[vid].videoHeight, 0, GL_format[vid], GL_UNSIGNED_BYTE, (const void*)(frame)); But this was missing at the end: glBindTexture(GL_TEXTURE_2D, 0); glActiveTexture(GL_TEXTURE0); But I'm not 100% convinced that this is the cause because if I read still images, there is no issue. Its only when I read videos that I see the flickering and black texture issue. It seems like when other widgets start rendering and there is a texture active, they somehow corrupt it but I would certainly appreciate it if anyone has input on what actually might be happening.
    • UNSOLVED Hello I have probem with the OpenGL on the Qt3dstudio qsurcface like the picture below
      QML and Qt Quick • opengl • • Chanapai  

      1
      0
      Votes
      1
      Posts
      66
      Views

      No one has replied

    • UNSOLVED From QOpenGLContext to CGLContext
      General and Desktop • opengl cocoa • • Ulysse  

      1
      0
      Votes
      1
      Posts
      61
      Views

      No one has replied

    • SOLVED can't read values from QOpenGLFramebuffer 2nd color attachment
      General and Desktop • opengl qopenglframebuf fbo • • strattonbrazil  

      2
      0
      Votes
      2
      Posts
      94
      Views

      I did in fact have to call glDrawBuffers myself. I assumed this was handled by the FBO binding, but apparently not. QOpenGLExtraFunctions* f = QOpenGLContext::currentContext()->extraFunctions(); GLenum bufs[2] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 }; f->glDrawBuffers(2, bufs); This seems strange to me that the FBO abstraction supports color attachments, but requires extra functions to use them.
    • SOLVED QOpenGLFramebufferObject renders only first frame
      QML and Qt Quick • opengl qtquick framebuffer • • Kyroaku  

      2
      0
      Votes
      2
      Posts
      263
      Views

      'Client vertex and index arrays - all vertex array attribute and element array index pointers must refer to buffer objects. The default vertex array object (the name zero) is also deprecated. Calling VertexAttribPointer when no buffer object or no vertex array object is bound will generate an INVALID_- OPERATION error, as will calling any array drawing command when no vertex array object is bound.' source: https://www.khronos.org/registry/OpenGL/specs/gl/glspec33.core.pdf page 344
    • SOLVED How to use anti-aliasing on QGLWidget?
      General and Desktop • opengl qopenglwidget antialiasing qglwidge • • BoboFuego  

      8
      0
      Votes
      8
      Posts
      907
      Views

      @BoboFuego said in How to use anti-aliasing on QGLWidget?: how can I add MyWidget.h as promoted class for it in the MainWindow constructor? Promoted class won't allow you to pass parameters to a constructor. Just don't add it in the designer at all. Lets say you've got this designer_widget as a central widget of the mian window in the designer. Just delete it entirely and add it in code: MainWindow::Mainwindow(QWidget* parent) : QMainWindow(parent) { ui->setupUi(this); MyWidget* gl_widget = new MyWidget(); setCentralWidget(gl_widget); }
    • UNSOLVED Window's content (OpenGL) freezes when interacting with its title bar - Bug?
      QML and Qt Quick • qml opengl window freezing • • IanShade  

      1
      0
      Votes
      1
      Posts
      129
      Views

      No one has replied

    • UNSOLVED Failure to find OpenGL and weird warnings in MSVC 2019
      General and Desktop • opengl qmake msvc2019 • • feistykittykat  

      2
      0
      Votes
      2
      Posts
      201
      Views

      @feistykittykat Don't know if I'm allowed to bump this bad boy up. Been struggling to use PVRVFrame or something similar to get openGL found on my machine, but I have no idea how to set it up for QT. Still not even sure if that's the source of my problem.
    • SOLVED Using a label to display large images in QT GUI
      General and Desktop • opengl opencv qlabel image display pixmap • • rtavakko  

      5
      0
      Votes
      5
      Posts
      359
      Views

      An update on this. It works perfectly and its a very low-cost solution. My processing time remains almost the same (~10mS) using this method since the painter does the scaling for you when it draws. Thanks for your help guys.
    • SOLVED qpainter performance
      General and Desktop • opengl qpainter performance • • dalishi  

      7
      0
      Votes
      7
      Posts
      388
      Views

      @kent-dorfman Thanks and will try out those methods also.
    • SOLVED Spout / OpenGL GL_RGBA to QImage
      General and Desktop • opengl spout • • rtavakko  

      10
      0
      Votes
      10
      Posts
      493
      Views

      Just to sum up this thread for anyone else having this issue, this would be the correct way to do it: QImage img; unsigned char* data; data = new unsigned char[4*width*height*sizeof(unsigned char)]; img = QImage((uchar*)(data),width,height,QImage::Format_RGBA8888); Make sure you allocate the appropriate space needed. E.g. if image format is RGB, size of the data array will be 3 * width * height * sizeof(unsigned char) and the QImage format will be QImage::Format_RGB888. Thanks all for your help.
    • UNSOLVED How to get vertices, normals and indeces from Qt3DRender::QAttribute buffer of Qt3DRender::QGeometry
      General and Desktop • opengl qt3d • • JulianM  

      2
      0
      Votes
      2
      Posts
      388
      Views

      @julianm You will have to set setSyncData(true); on the attribute-buffers and also synch the index buffers to get the right vertices.
    • UNSOLVED Incorrect Position of viewport in OpenGL + Qt
      General and Desktop • opengl qopenglwidget • • sckorpio  

      2
      0
      Votes
      2
      Posts
      263
      Views

      Hi and welcome to devnet, From the looks of it you are using both glu and the fixed pipeline. Since you are starting a new project, may a suggest taking a look at the Qt OpenGL examples and their use of current technologies like shaders ?
    • UNSOLVED QWindow - openGL implementation, painter not paiting?
      General and Desktop • opengl qwindow • • Dariusz  

      4
      0
      Votes
      4
      Posts
      335
      Views

      Hi Hmm, nope. it looks very much like the sample with some code from TriangleWindow::initialize() in the render() function.
    • UNSOLVED Get context /Id of QOpenGLBuffer, data wont render - debuging help.
      General and Desktop • opengl qopengl • • Dariusz  

      1
      0
      Votes
      1
      Posts
      182
      Views

      No one has replied

    • SOLVED Displaying widgets on top of Opengl widget (Ogre engine)
      General and Desktop • opengl transparency ogre • • gabbsson  

      7
      0
      Votes
      7
      Posts
      1391
      Views

      @SGaist My solution is heavily inspired by: this old ogre wiki post (should have linked it as well, forgot about it until now). I mostly slimmed it down to what I posted as my solution, but I agree if I have time I'll try to make an example/entry. There are some things that need to be updated from the linked post to fit Ogre 2.1 since the post is old.
    • UNSOLVED How to convert voice to text with QOpenGL
      General and Desktop • c++ opengl qopengl speech voice recogniti • • HW-Developer  

      8
      0
      Votes
      8
      Posts
      720
      Views

      @HW-Developer OK, I don't want to discourage you, maybe you just want to play with it, I've said I have no knowledge. But maybe if that sort of thing was freely available from 2005 there are some more recent ones which might be better?