Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. CubeMap setData(…,&QImage) cause atio6axx.dll exception only under Windows

CubeMap setData(…,&QImage) cause atio6axx.dll exception only under Windows

Scheduled Pinned Locked Moved Solved Game Development
cube mapsetdataqimagewindows 10
10 Posts 2 Posters 4.7k 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
    Artorias
    wrote on 19 Jun 2016, 19:55 last edited by
    #1

    Greetings,
    I am trying to reflect my skybox with a cubeMap.
    I am using within Visual Studio 2015 EE (running under windows 10) and the Microsoft compiler.
    When my constructor of my skybox class tries to create the cubemap i get the atio6axx.dll exception.
    I tested if my QImage* Array is filled (indeed it is) and wether the pointer isnt empty.
    But the exception is telling me. Access violation reading at position 0xblablabla.
    What most confuses me that the problem does not occur on Linux.
    This fact drives my crazy.

    Here the creation of the Skybox in my scene and the callings (Scene.cpp/.h):

    //scne.h
    Skybox *m_skybox;
    //scene.cpp
    Scene::Scene(QWidget *parent) :  QGLWidget(parent)
    {...
         m_skybox = nullptr;
    ...}
    void Scene::resetScene()
    {
        //delete lights and models
        m_models.clear();
        m_lights.clear();
        m_selectedModel = -1;
    	//skybox
    	m_skybox = new Skybox();
    ...}
    

    Skybox.h

    class Skybox
    {
    public:
        Skybox();
    
        virtual void render(QGLShaderProgram *program, QVector3D cameraPosition);
    	QOpenGLTexture *cube_texture;
        //void readSkyboxFile(QString fileName);
    
    private:
          QOpenGLTexture *textures[6];
    
    	  QGLFunctions gl;
    
    	  QImage* images[6];
    ...};
    

    Skybox.cpp

    Skybox::Skybox()
    {
    
        // An dieser Stelle wird wieder die nullte Texturebene genutzt.
    	gl.initializeGLFunctions(QGLContext::currentContext());
        gl.glActiveTexture(GL_TEXTURE0);
    	gl.glActiveTexture(GL_TEXTURE4);
    	
    	images[0] = new QImage(QString("skybox/front.png"));
    	images[1] = new QImage(QString("skybox/right.png"));
    	images[2] = new QImage(QString("skybox/up.png"));
    	images[3] = new QImage(QString("skybox/back.png"));
    	images[4] = new QImage(QString("skybox/left.png"));
    	images[5] = new QImage(QString("skybox/down.png"));
    
    	cube_texture = new QOpenGLTexture(QOpenGLTexture::TargetCubeMap);
    	cube_texture->create();
    	cube_texture->setSize(images[0]->width(), images[0]->height());
    	cube_texture->setFormat(QOpenGLTexture::RGBAFormat);
    	cube_texture->allocateStorage();
    	
    	cube_texture->setData(0, 0, QOpenGLTexture::CubeMapPositiveX, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, images[0]);
    	cube_texture->setData(0, 0, QOpenGLTexture::CubeMapPositiveY, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, images[1]);
    	cube_texture->setData(0, 0, QOpenGLTexture::CubeMapPositiveZ, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, images[2]);
    	cube_texture->setData(0, 0, QOpenGLTexture::CubeMapNegativeX, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, images[3]);
    	cube_texture->setData(0, 0, QOpenGLTexture::CubeMapNegativeY, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, images[4]);
    	cube_texture->setData(0, 0, QOpenGLTexture::CubeMapNegativeZ, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, images[5]);
    	
    
    	cube_texture->generateMipMaps();
    	cube_texture->setMinMagFilters(QOpenGLTexture::Linear, QOpenGLTexture::Linear);
    
    	textures[0] = new QOpenGLTexture( QImage(QString("skybox/right.png")).mirrored(true,true));
        textures[1] = new QOpenGLTexture( QImage(QString("skybox/front.png")));
        textures[2] = new QOpenGLTexture( QImage(QString("skybox/down.png")).mirrored());
        textures[3] = new QOpenGLTexture( QImage(QString("skybox/back.png")).mirrored(true,false));
        textures[4] = new QOpenGLTexture( QImage(QString("skybox/left.png")).mirrored());
        textures[5] = new QOpenGLTexture( QImage(QString("skybox/up.png")));
    
    }
    

    It would be great when somebody could help me :)

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 19 Jun 2016, 21:14 last edited by
      #2

      Hi and welcome to devnet,

      From the looks of it, you have a Graphic Card driver problem. Are you using the latest ATI driver ? What is your card ?

      Can you test your application on a system with a different card e.g. a nVidia ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Artorias
        wrote on 20 Jun 2016, 20:41 last edited by
        #3

        Indeed I have an ATI Card (R9 380x).
        Today I tried my code on two Computer. One with win10 and a gtx980 where this error occures when debuggin the fragment shader:
        QGLShader:: compile<Fragment>: 0<61> : error C7531: global function textureCube requieres "#extension GL_NV_shadow_samplers_cube : enable" before use.

        Here my incomplete Shader code:

        #version 330 core
        // Blinn Shader
        uniform vec3 matAmbient;
        uniform vec3 matDiffuse;
        uniform vec3 matSpecular;
        uniform float matShininess;
        uniform float matAlpha;
        uniform samplerCube cubeTexture;
        uniform sampler2D diffTexture;
        uniform vec3 ambient[5];
        uniform vec3 diffuse[5];
        uniform vec3 specular[5];
        uniform float shininess;
        uniform int lightSize;
        //In Vektoren vom Vertex
        in vec4 handle_N;	//q normale
        in vec4 handle_L[5]; // q -> Licht
        in vec4 handle_V;	// q -> Kamera
        in vec2 handle_texcoords;
        out vec4 finalcolor;
        vec3 diffuseLight(in vec4 N, in vec4 L)
        {
           // calculation as for Lambertian reflection
           float diffuseTerm = max(0.0,dot(N, L)) ;
           //float diffuseTerm = dot(N, L) ;
           vec3 temp = clamp(matDiffuse * diffuseTerm,0,1);
           return temp;
        }
        vec3 specularLight(in vec4 N, in vec4 L, in vec4 V)
        {
        	float temp = 0;
        	vec4 reflection = normalize(reflect(-L, N));
        	//Falls die Oberfläche nicht im totalem Schatten liegt
        	if(dot(N,L)<0){
        		return vec3(0.0,0.0,0.0);
        	}
        	else{
        		float s = shininess*matShininess;
        		temp = pow(max(dot(reflection,V),0.0),s);		
        	}
        	return matSpecular*temp;
        }
        void main()
        {
        	//normalisiere Vektoren
        	vec4 N = normalize(handle_N);
        	vec4 V = normalize(handle_V);
        	//Berechne Blinn-Phong
        	vec3 Iamb = vec3(0.0,0.0,0.0);
        	vec3 Idiff = vec3(0.0,0.0,0.0);
        	vec3 Ispec = vec3(0.0,0.0,0.0);
        	for(int i=0;i<lightSize;i++){
        	Iamb += ambient[i]*matAmbient;
        	Idiff += diffuse[i]*diffuseLight(N,normalize(handle_L[i]));
        	Ispec += specular[i]*specularLight(N,normalize(handle_L[i]),V);
        	}
        	vec3 reflection = reflect(V,N).xyz;
        	vec3 reflectColor = textureCube(cubeTexture,reflection).rgb;
        	if(handle_texcoords.x<0 || handle_texcoords.y<0)
        	{
        		finalcolor.xyz = Iamb+Idiff+Ispec;
        		finalcolor.a = matAlpha;		
        	}
        	else
        	{
        		vec3 diffuseColor = texture(diffTexture, handle_texcoords).rgb;
        		finalcolor.xyz = reflectColor*diffuseColor*(Iamb+Idiff+Ispec);
        		finalcolor.a = matAlpha;
        	}	
        }
        

        And a fellow Student tested my code on a openSuse with a nVidia Card and there the code runs without any exceptions or compiler errors...

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 20 Jun 2016, 20:51 last edited by SGaist
          #4

          @Artorias said:

          error C7531: global function textureCube requieres "#extension GL_NV_shadow_samplers_cube : enable" before use.

          Did you add #extension GL_NV_shadow_samplers_cube : enable to your shader and test it again ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Artorias
            wrote on 20 Jun 2016, 20:56 last edited by
            #5

            I tried it and nothing has changed :/
            Dont know if I just should switch the OS for QT/c++ developement.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 20 Jun 2016, 20:59 last edited by
              #6

              Even on the nVidia card ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Artorias
                wrote on 20 Jun 2016, 21:30 last edited by
                #7

                Even on the nVidia :|

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 20 Jun 2016, 21:53 last edited by
                  #8

                  Do you get the same error or just the crash ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    Artorias
                    wrote on 22 Jun 2016, 12:24 last edited by
                    #9

                    Hey, I solved it:

                    cube_texture->setData(0, 0, QOpenGLTexture::CubeMapPositiveX, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, (const void*)images[0]->bits());
                    	cube_texture->setData(0, 0, QOpenGLTexture::CubeMapPositiveY, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, (const void*)images[1]->bits());
                    	cube_texture->setData(0, 0, QOpenGLTexture::CubeMapPositiveZ, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, (const void*)images[2]->bits());
                    	cube_texture->setData(0, 0, QOpenGLTexture::CubeMapNegativeX, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, (const void*)images[3]->bits());
                    	cube_texture->setData(0, 0, QOpenGLTexture::CubeMapNegativeY, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, (const void*)images[4]->bits());
                    	cube_texture->setData(0, 0, QOpenGLTexture::CubeMapNegativeZ, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, (const void*)images[5]->bits());
                    
                    1 Reply Last reply
                    1
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 22 Jun 2016, 14:47 last edited by
                      #10

                      Haaaaaa… I missed that… You didn't pass the pointer to the QImage data...

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      3/10

                      20 Jun 2016, 20:41

                      topic:navigator.unread, 7
                      • Login

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