SkyBox how to use QOpenGLTexture?



  • 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]



  • Does anyone know?



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

    Thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.