Texture loaded with SOIL isn't displayed

Here’s the thing: I don’t get any SOIL or OpenGL errors, and yet the image I load isn’t displayed.

Texture load & draw code:


// textures is std::map<std::string, GLuint>
if (textures.find(imagepath)==textures.end())
    {
    textures[imagepath] = SOIL_load_OGL_texture(imagepath.c_str(),
                                                SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,0);
    owner->setdbgstr("loading texture...");
    }
else if(textures[imagepath]!=0)
    {
        owner->setdbgstr("texture is loaded successfully");

        oglImage(textures[imagepath]);

        std::string error = "toll!";
        GLenum laste = GL_NO_ERROR;
        while(true)
        {
            GLenum err = glGetError();
            if ( err == GL_NO_ERROR )
                break;
            if ( err == laste )
            {
                errr = "Error with glGetError()";
                break;
            }
            laste = err;
            error = "OpenGL error: "+std::to_string(err);
        }
        owner->setdbgstr(error);
    }
else
    {
    owner->setdbgstr("Error loading image: " + std::string(SOIL_last_result(),0,3));
    }

oglImage:


void oglImage(GLuint gluimage)
{
    double ww, hh;
    ww=100.0;
    hh=100.0;
    double r = 1.0, g = 1.0, b = 1.0, a = 1.0;
    double points[] =
    {
        0.0, 0.0,   r, g, b, a, 0.0, 0.0,
        0.0,  hh,   r, g, b, a, 0.0, 1.0,
         ww,  hh,   r, g, b, a, 1.0, 1.0,
         ww, 0.0,   r, g, b, a, 1.0, 0.0
    };
    GLuint vbo;
    glGenBuffersARB(1, &vbo);
    glBindBufferARB(GL_ARRAY_BUFFER, vbo);
    glBufferDataARB(GL_ARRAY_BUFFER,4 * sizeof(double) * 8,&points[0],GL_STATIC_DRAW);

    glEnable(GL_TEXTURE_2D);
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);

    glBindTexture(GL_TEXTURE_2D, gluimage);

    glBindBufferARB(GL_ARRAY_BUFFER, vbo);
    glVertexPointer(2, GL_DOUBLE, sizeof(double) * 8, NULL);
    glTexCoordPointer(2, GL_DOUBLE, sizeof(double) * 8, (void*)(sizeof(double)*6));
    glDrawArrays(GL_QUADS, 0, 4);
    //glFlush() is called later down the line, other gl elements are drawn just fine

    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    glDisableClientState(GL_VERTEX_ARRAY);
    glDisable(GL_TEXTURE_2D);
}

Another version of oglImage, only draws a white square:

void oglImage(GLuint gluimage)
{
    double ww, hh;
    ww=100.0;
    hh=100.0;
    double r = 1.0, g = 1.0, b = 1.0, a = 1.0;
    double points[] =
    {
        0.0, 0.0,   r, g, b, a, 0.0, 0.0,
        0.0,  hh,   r, g, b, a, 0.0, 1.0,
         ww,  hh,   r, g, b, a, 1.0, 1.0,
         ww, 0.0,   r, g, b, a, 1.0, 0.0
    };

    GLuint vao;
    glGenVertexArraysAPPLE(1, &vao);
    glBindVertexArrayAPPLE(vao);
    GLuint vbo1;
    glGenBuffersARB(1, &vbo1);
    //vbo1 = image;
    glBindBufferARB(GL_ARRAY_BUFFER, vbo1);
    //glBindBufferARB(GL_ARRAY_BUFFER, image);
    glBindTexture(GL_TEXTURE_2D, gluimage);
    glBufferDataARB(GL_ARRAY_BUFFER,4 * sizeof(double) * 8,&points[0],GL_STATIC_DRAW);
    glVertexPointer(2, GL_DOUBLE, sizeof(double) * 8, NULL);
    glColorPointer(4, GL_DOUBLE, sizeof(double) * 8, (void*)(sizeof(double)*2));
    glTexCoordPointer(2, GL_DOUBLE, sizeof(double) * 8, (void*)(sizeof(double)*6));
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glDrawArraysEXT(GL_QUADS, 0, 4);
    glDisableClientState(GL_COLOR_ARRAY);
    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}

There’s so much wrong with this code that it’s difficult to know where to start.

You’re mixing extension and non-extenstion versions of function calls and enums.

You’re mixing VAOs with legacy fixed vertex attributes.

You’re using doubles.

You’re leaking memory and object handles.

I suggest that you fix your code so that it’s at least conformant with the spec and documentation, then see if the problem recurs.

[QUOTE=mhagain;1286717]There’s so much wrong with this code that it’s difficult to know where to start.

You’re mixing extension and non-extenstion versions of function calls and enums.

You’re mixing VAOs with legacy fixed vertex attributes.

You’re using doubles.

You’re leaking memory and object handles.

I suggest that you fix your code so that it’s at least conformant with the spec and documentation, then see if the problem recurs.[/QUOTE]

I used extension versions whenever non-extension ones were not available - am on 1.4. All other times I used the non-extension versions, as there are no non-extension versions.

I wasn’t sure on using VAOs, but read that they should always be used to provide forward compability. Or have I misread something?

Why is using doubles wrong?

If by leaking object handles you mean the map, I do need to display multiple images simultaneously. Or do you have something else in mind?