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. Set TextureData to a Texture2D or Texture3D in Qt3D
QtWS25 Last Chance

Set TextureData to a Texture2D or Texture3D in Qt3D

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt3dqmljavascript
2 Posts 2 Posters 463 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.
  • A Offline
    A Offline
    Abolfazl
    wrote on 26 Aug 2021, 07:18 last edited by
    #1

    Hi everyone,
    In all Qt examples, the Texture2D gets a TextureImage with a source to display an image in scene3D. But I was wondering if it is possible to create an RGBAformat array and set it to a Texture2D?
    Additionally, I generated an array using the following code in javascript and set it to the data of a Texture2D, but it does not show anything.

                                    var array = new Uint8Array(400 * 400 * 4);
                                    for(var i=0; i< 400 * 400; i++){
                                        // RGB from 0 to 255
                                        array[4*i] = array[4*i + 1] = array[4*i + 2] = 255;
                                        // OPACITY
                                        array[4*i + 3] = 255;
                                    }
                                    return array
    

    How I can fix this issue?
    Thank you.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stretchthebits
      wrote on 26 Aug 2021, 17:55 last edited by
      #2

      It's been a long time since I used OpenGL.
      OpenGL version 1.1 to 2.1 handle power of 2 textures.
      I think it is with GL 3.0 that non pow-2 textures work. I think you have to explicitly create a GL 3.0 or above context. But I could be wrong.

      Also, try making a 256 x 256 or 256 x 512 or 512 x 512 texture.

      1 Reply Last reply
      0

      1/2

      26 Aug 2021, 07:18

      • Login

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