skybox not loading

Tagged: 

This topic contains 6 replies, has 2 voices, and was last updated by  john lam 4 years, 8 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #31222

    john lam
    Member

    hey guys I have tried to load in my skybox texture but it fires up the error that I have setup for it and don’t really understand why, I have added in the code as such(I am using the skybox in the skybox2 demo).

    bool OGLESIntroducingPVRTools::load_Tex(CPVRTString* const pErrorStr){

    for(int texNo = 0; texNo < 2; ++texNo){
    if(PVRTTextureLoadFromPVR(c_szTextureFile[texNo], &m_uiTexture[texNo]) != PVR_SUCCESS)
    {
    *pErrorStr = CPVRTString("Error: This texture number could not be loaded number:") + texNo;
    return false;
    }
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    }

    if(PVRTTextureLoadFromPVR(c_szTextureFile[2], &m_uiTexture[2]))
    {
    *pErrorStr = CPVRTString("ERROR: Cannot open skybox");
    return false;
    }

    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

    return true;
    }

    I then call this method within InitView method like this as one of your examples showed.

    if(!load_Tex(&Error_message)){
    PVRShellSet(prefExitMessage, Error_message.c_str());
    return false;
    }

    and at the top I have defined the file name in an array along with the other texture files

    const char* c_szTextureFile[n_TexFile] =
    { "n_Map1.pvr",
    "n_Map2.pvr",
    "Skybox.pvr"};

    and in you skybox2 demo you used effect files…I am still using the seperate vert and frag shaders and was wondering how I could change my code in order to do what your method was doing. I’m not quite sure how to actually set the sampler Currently my drawSkybox looks like this which I am not sure if it is right, I then call this in the renderscene method and enable cull face then disable it after:

    void OGLESIntroducingPVRTools::DrawSkybox(){
    //draw skybox
    glBindBuffer(GL_ARRAY_BUFFER, m_skyBoxVBO);
    glEnableVertexAttribArray(sky_VERTARRAY);
    glUniform1i(glGetUniformLocation(skyShaderProgram.uiId, "SkyTex"), 3);
    for(int face = 0; face < 6; ++face){
    size_t offset = sizeof(float) * face*4*3;
    glVertexAttribPointer(sky_VERTARRAY, 3, GL_FLOAT, GL_FALSE, sizeof(float)*3, (void*) offset);
    }
    }

    #37045

    john lam
    Member

    Also I was wondering how big the drawing surface actually is? or Viewport

    #37046

    dgu
    Member

    Hello John,

    inline float GetVirtualWidth()
    {
    return (float)(IsRotated() ? PVRShellGet(prefHeight) : PVRShellGet(prefWidth));
    }

    inline float GetVirtualHeight()
    {
    return (float)(IsRotated() ? PVRShellGet(prefWidth) : PVRShellGet(prefHeight));
    }

    regards
    david

    #37047

    dgu
    Member

    about your skybox ,
    are you sure that you Filewrap it ? does the naming matches ?

    #37048

    john lam
    Member

    Hi David,
    I have filewrapped it and the naming does match but I am still getting that error message fired.

    #37049

    dgu
    Member

    then it is the encoding of the image

    #37050

    john lam
    Member

    I took the original one from the skybox2 folder but still no luck

Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic.