   DevIL - I'm having a problem rendering to a GL_QUAD
I previously drew my image to the color buffer. It worked fine. Now I'm trying to render it to a GL_QUAD. The image is 1280x800, which is the same as my screen resolution, and on execution I'm getting a light-gray screen. Likewise, if I have a 64x64 image on the screen, I get a gray 64x64 box. Is there anything below that might suggest why the image is not displaying appropriately? Also please note I'm using GL_TEXTURE_RECTANGLE_ARB. Thanks in advanced.bool Image::init(const string &filename){    // Check if this is the first time initializing an image    if (refCount == 0)    {   // Init DevIL   ilInit();   iluInit();   ilutRenderer(ILUT_OPENGL);    }    // Generate the image    ilGenImages(1, &m_handle);// Bind the current image    ilBindImage(m_handle);    glEnable(GL_TEXTURE_RECTANGLE_ARB);    glBindTexture(GL_TEXTURE_RECTANGLE_ARB, m_handle);    glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);    glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);    glTexImage2D(GL_TEXTURE_RECTANGLE_ARB,0,ilGetInteger(IL_IMAGE_BPP),ilGetInteger(IL_IMAGE_WIDTH),ilGetInteger(IL_IMAGE_HEIGHT),0, ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE,ilGetData());    // load the image    if (!ilLoadImage(filename.c_str())) {   ilDeleteImages(1, &m_handle);return false;    }  // Check if image is backwards    if (ilGetInteger(IL_IMAGE_ORIGIN) != IL_ORIGIN_LOWER_LEFT) {   m_flipped = true;   iluFlipImage();    }    ilOriginFunc(IL_ORIGIN_UPPER_LEFT);  ilEnable(IL_ORIGIN_SET);  // convert to IL_RGBA    ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE);// get the image's width and height    m_width = ilGetInteger(IL_IMAGE_WIDTH);    m_height = ilGetInteger(IL_IMAGE_HEIGHT);    m_size = ilGetInteger(IL_IMAGE_SIZE_OF_DATA);    m_imageType = ilGetInteger(IL_IMAGE_TYPE);    // Set initial color components    m_red = 1.0f;    m_green = 1.0f;    m_blue = 1.0f;    m_alpha = 1.0f;   // Increase the reference count    refCount++;    // Show state    m_show = true;   GLfloat m_lights[4];    m_lights[0] = 1.0f;    m_lights[1] = 1.0f;    m_lights[2] = 1.0f;    m_lights[3] = 1.0f;    glEnable(GL_LIGHTING);    glLightfv(GL_LIGHT0,GL_DIFFUSE,m_lights);    glEnable(GL_LIGHT0);    return true;}void Image::draw(){    if (!m_show)   return;    //ilBindImage(m_handle);    glBindTexture(GL_TEXTURE_RECTANGLE_ARB, m_handle);// Set color scale    glPixelTransferf(GL_RED_SCALE, m_red);    glPixelTransferf(GL_GREEN_SCALE, m_green);    glPixelTransferf(GL_BLUE_SCALE, m_blue);    glPixelTransferf(GL_ALPHA_SCALE, m_alpha);    // Draw to color buffer    //glRasterPos2f(m_x, m_y + m_height); //glDrawPixels(ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT),    //    ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE, ilGetData());    glPushMatrix();    glTranslatef(m_x, m_y, 0.0f);    glBegin(GL_QUADS);   glTexCoord2f(0,0);   glVertex2f(0, m_height);   glTexCoord2f(m_width, 0);   glVertex2i(m_width, m_height); glTexCoord2f(m_width, m_height);   glVertex2i(m_width, 0); glTexCoord2i(0, m_height);   glVertex2i(0,0);    glEnd();    glPopMatrix();}Ortho:void Game_Resize(int width, int height){    // Prevent divide by zero    if (height == 0)   height = 1;    // Set viewport    glViewport(0, 0, width, height);    // Reset coordinate system    glMatrixMode(GL_PROJECTION);    glLoadIdentity();   gluOrtho2D(0.0, win.getInitialWidth(), win.getInitialHeight(), 0.0);    // Model view    glMatrixMode(GL_MODELVIEW);    glLoadIdentity();}
You are trying to set the texture pixel data before loading the image. Try moving this line:glTexImage2D(GL_TEXTURE_RECTANGLE_ARB,0,ilGetInteger(IL_IMAGE_BPP),ilGetInteger(IL_IMAGE_WIDTH),ilGetInteger(IL_IMAGE_HEIGHT),0, ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE,ilGetData());To somewhere below this one:ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE);