Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

image content

vreal
2012-05-29
2013-05-02
  • vreal
    vreal
    2012-05-29

    Hi, I try to read a small image I created (64x64) which is completely red:

       ilInit();
       ILuint ImageName;
       ilGenImages(1, &ImageName);
       ilBindImage(ImageName);
       wchar_t* imgFilename = L"..\\..\\resources\\textures\\red.png";
       ilLoadImage(imgFilename);
       ILubyte* texture = ilGetData();
       for (int i=0; i<64; i++) cout << (int)texture_ << endl;    // output first row

    Should the output on the last line be 255 0 0 255 0 0 255 0 0 …?
    I ask because this is not the case.
    I have a problem with my textures in OpenGL and I am trying to find the problem. So I started at the beginning - when loading the image._

     
  • vreal
    vreal
    2012-06-04

    I found the answer. Yes it should be.
    But with this code my program crashes when sending the texture to the graphics card:

    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, _texture);
    

    But as I have read in tutorials this should be all that is necessary.
    Can anybody help me out with this?