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. SkyBox how to use QOpenGLTexture?
Forum Updated to NodeBB v4.3 + New Features

SkyBox how to use QOpenGLTexture?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.7k Views 1 Watching
  • 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.
  • B Offline
    B Offline
    banwenxiaoyu
    wrote on last edited by
    #1

    I try

    @
    skyTex = new QOpenGLTexture( QOpenGLTexture::TargetCubeMap );
    skyTex->create();
    skyTex->bind();

    QString fileName;
    fileName = "/Users/army/code/QT_OpenGL/OpenGLQT_Demos/assets/skybox/snow_posx.jpg";
    QImage image_posx( fileName );
    skyTex->setData( 0,0,QOpenGLTexture::CubeMapPositiveX,QOpenGLTexture::RGB,QOpenGLTexture::UInt8,image_posx.bits() );
    
    fileName = "/Users/army/code/QT_OpenGL/OpenGLQT_Demos/assets/skybox/snow_negx.jpg";
    QImage image_negx( fileName );
    skyTex->setData( 0,0,QOpenGLTexture::CubeMapNegativeX,QOpenGLTexture::RGB,QOpenGLTexture::UInt8,image_negx.bits() );
    
    fileName = "/Users/army/code/QT_OpenGL/OpenGLQT_Demos/assets/skybox/snow_posy.jpg";
    QImage image_posy( fileName );
    skyTex->setData( 0,0,QOpenGLTexture::CubeMapPositiveY,QOpenGLTexture::RGB,QOpenGLTexture::UInt8,image_posy.bits() );
    
    fileName = "/Users/army/code/QT_OpenGL/OpenGLQT_Demos/assets/skybox/snow_negy.jpg";
    QImage image_negy( fileName );
    skyTex->setData( 0,0,QOpenGLTexture::CubeMapNegativeY,QOpenGLTexture::RGB,QOpenGLTexture::UInt8,image_negy.bits() );
    
    fileName = "/Users/army/code/QT_OpenGL/OpenGLQT_Demos/assets/skybox/snow_posz.jpg";
    QImage image_posz( fileName );
    skyTex->setData( 0,0,QOpenGLTexture::CubeMapPositiveZ,QOpenGLTexture::RGB,QOpenGLTexture::UInt8,image_posz.bits() );
    
    fileName = "/Users/army/code/QT_OpenGL/OpenGLQT_Demos/assets/skybox/snow_negz.jpg";
    QImage image_negz( fileName );
    skyTex->setData( 0,0,QOpenGLTexture::CubeMapNegativeZ,QOpenGLTexture::RGB,QOpenGLTexture::UInt8,image_negz.bits() );
    

    // skyTex->create();

    skyTex->setWrapMode(QOpenGLTexture::DirectionS, QOpenGLTexture::Repeat  );
     skyTex->setWrapMode(QOpenGLTexture::DirectionR, QOpenGLTexture::Repeat  );
     skyTex->setWrapMode(QOpenGLTexture::DirectionT, QOpenGLTexture::Repeat  );
     skyTex->setMinificationFilter( QOpenGLTexture::Linear );
     skyTex->setMagnificationFilter(  QOpenGLTexture::Linear );
    

    // skyTex->setSize(512*512,1);
    skyTex->setBorderColor( 1,0,0,1 );
    @

    But to no avail, how do I start? Thank you

    [edit: added missing coding tags @ SGaist]

    1 Reply Last reply
    0
    • B Offline
      B Offline
      banwenxiaoyu
      wrote on last edited by
      #2

      Does anyone know?

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jjjj
        wrote on last edited by
        #3

        Did you solve it? I have a similar problem but only on Windows and Linux. In OSX works correctly.

        Thanks

        1 Reply Last reply
        0

        • Login

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