Re: trouble loading texture

New Message Reply Date view Thread view Subject view Author view

From: Tim Gion (tcg3j++at++cs.virginia.edu)
Date: 02/23/2000 11:26:23


On Wed, 23 Feb 2000, Brian Furtaw wrote:

> I don't have the contents of your callback so I can't say what you are
> doing right or wrong. If you call pfGetEnable(PFEN_TEXTURE) does it
> return true? Have you setup a TextureEnv? The man for pfTexture tells me
> apply takes care of calling load and format methods for you. This seems
> to be so in all the examples I can find. Does the texture have power of
> two dimensions? I am just grabbing at straws here can you provide some
> test code that demonstrates the problem? Does the texture load fine
> through Performer, try this iv file,

I'm posting the callback below. Textures are enabled and the
pfGetEnable() call confirmed that. The texture does have two dimensions
and it displayed fine in perfly with your Inventor file. I explicitly set
up a pfTexEnv and applied it, but didn't have any luck with that either.
Here's the callback:

static void
drawWater(vgChannel* chan, void* udata)
{
    GLint matmode, mm;
    GLfloat projmat[16];
    GLboolean cullface, texon;
    int trans;
    static float alpha = 0.5f;

    trans = pfGetTransparency();
    glGetBooleanv(GL_CULL_FACE, &cullface);
    glGetBooleanv(GL_TEXTURE_2D, &texon);

    pfPushState();

    pfGetTransparency(PFTR_FAST);
    glDisable(GL_CULL_FACE);

    pfDisable(PFEN_LIGHTING);

    pfPushIdentMatrix();
    glDisable(GL_DEPTH_TEST);
    glGetIntegerv(GL_MATRIX_MODE, &matmode);
    glMatrixMode(GL_PROJECTION);
    glGetFloatv(GL_PROJECTION_MATRIX, projmat);
    glMatrixMode(matmode);
    glGetIntegerv(GL_MATRIX_MODE, &mm);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluOrtho2D(0.0f, 1.0f, 0.0f, 1.0f);
    glMatrixMode(mm);

    if(!texon)
        glEnable(GL_TEXTURE_2D);

    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
    pfEnable(PFEN_TEXTURE);
    pftexenv->apply();
    pftex->apply();

    glBegin(GL_QUADS);
    glColor4f(1.0f, 1.0f, 1.0f, alpha);
    glVertex2f(0.0f, 0.0f);
    glTexCoord2f(0.0f, 0.0f);
    glVertex2f(1.0f, 0.0f);
    glTexCoord2f(1.0f, 0.0f);
    glVertex2f(1.0f, 1.0f);
    glTexCoord2f(1.0f, 1.0f);
    glVertex2f(0.0f, 1.0f);
    glTexCoord2f(0.0f, 1.0f);
    glEnd();

    if(!texon)
        glDisable(GL_TEXTURE_2D);

    pfPopMatrix();
    glMatrixMode(GL_PROJECTION);
    glLoadMatrixf(projmat);
    glMatrixMode(matmode);
    glEnable(GL_DEPTH_TEST);

    pfEnable(PFEN_LIGHTING);
    pfTransparency(trans);
    glEnable(cullface);
    pfPopState();

    glFlush();
}

Tim Gion
tcg3j++at++cs.virginia.edu (fastest) or gion++at++cs.virginia.edu
http://www.cs.virginia.edu/~tcg3j


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 11:26:31 PST

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