how to draw a background image

New Message Reply Date view Thread view Subject view Author view

From: Stephane Jaeger (stephane.jaeger++at++imag.fr)
Date: 05/28/2001 10:05:49


I finally Made it work, I just had forgotten a glLoadIdentity() after
the gluOrtho2D.
Below is the final piece of code, it might be of some interest for
somebody.
Thank you all for your help,
Bye Stephane

void MyDrawCallBack (pfChannel *channel, void *)
{
  int mode[1];
  SoftShadow *softy = application->GetSoftShadow();

    // erase framebuffer and draw Earth-Sky model
    channel->clear();
    glGetIntegerv(GL_MATRIX_MODE,mode);

    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    gluOrtho2D(-1,1,-1,1);

    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    glLoadIdentity();

    glDepthMask(GL_FALSE);
    pfEnable(PFEN_TEXTURE);
    softy->spotEnv->apply();
    softy->spotTex->apply();
    glBegin(GL_QUADS);
      glTexCoord2f(0.,1.);
      glVertex2f(-1.0,1.0);
      glTexCoord2f(0.,0.);
      glVertex2f(-1.0,-1.0);
      glTexCoord2f(1.,0.);
      glVertex2f(1.0,-1.0);
      glTexCoord2f(1.,1.);
      glVertex2f(1.0,1.0);
    glEnd();

    glPopMatrix();
    glMatrixMode(GL_PROJECTION);
    glPopMatrix();
    glDepthMask(GL_TRUE);
    glMatrixMode(mode[0]);

    pfDraw();


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon May 28 2001 - 10:04:28 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.