Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. OpenGL Image Load/Store using Qt 5.7?
Servers for Qt installer are currently down

OpenGL Image Load/Store using Qt 5.7?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt5openglshaderqt5.7image
1 Posts 1 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    otah007
    wrote on 8 Aug 2016, 14:49 last edited by
    #1

    I'm trying to port some code across from a non-Qt project to Qt and I can't get image load/store to work. I've created my texture and bound it to the shaders, but it doesn't seem to be reading the data - all I get is a black screen, which means the values are all 0. Is there any Qt-native way to use image load/store, and if not how do I use standard OpenGL functions to make it work with Qt shader programs?

    float* data = new float[IMAGE_WIDTH * IMAGE_HEIGHT];
    for (int i = 0; i < IMAGE_WIDTH * IMAGE_HEIGHT; ++i)
    	data[i] = float(i) / float(IMAGE_WIDTH * IMAGE_HEIGHT);
    
    GLuint tex[1];
    glGenTextures(1, tex);
    glBindTexture(GL_TEXTURE_2D, tex[0]);
    glTexStorage2D(GL_TEXTURE_2D, 1, GL_R32F, IMAGE_WIDTH, IMAGE_HEIGHT);
    glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, GL_RED, GL_FLOAT, data);
    
    delete[] data;
    
    m_program->bind();
    glBindImageTexture(0, tex[0], 0, GL_FALSE, 0, GL_READ_WRITE, GL_R32F);
    m_program->release();
    
    m_compute->bind();
    glBindImageTexture(0, tex[0], 0, GL_FALSE, 0, GL_READ_WRITE, GL_R32F);
    m_compute->release();
    

    The shaders definitely work as they are identical to the ones used in the non-Qt project. However I'm not sure if this is the correct way to bind the image using Qt:

    // Image from image load/store
    layout (binding = 0, r32f) uniform image2D pixels;
    

    Any help would be very much appreciated.

    1 Reply Last reply
    0

    1/1

    8 Aug 2016, 14:49

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved