image over an opengl app?

ok, here is my problem:
I have got to put the cover of a magazine over an OpenGL application. This app is implemented over a weird library named “acu”. What did i figured out? I did a scan of the cover, transformed it in an RGBA TGA and tried to make a transparent texture. My idea was to put the texture over the app, so the text was displayed and the rest of the image (with alpha == 0) was transparent. Here started the troubles: my texture just won’t be displayed. Why? It is 512x512 so it isn’t the notorious 2^someting problem. TEXTURE_2D is enable and the same piece of code works in a normal opengl context. I tried to figure out what the heck this “acu” lib doed, but so far no good. Anyone has ANY idea of what to do? i have also the
glEnable(GL_BLEND)
glEnable(GL_ALPHA_TEST)
stuff running. I just have no clues.
I tried also to write the image PIXEL per PIXEL (weird, i know) bou the bit table looks somehow screwed up (i have a y++ for-cicle, but my pixels aren’t just near one to another. They look like the are 20 lines away one from the others). So what can I do? I am quite desparate, so any help is well appreciated.
Thanks my friends, the Gunslinger

there are a lot of possible reasons for which a texture probably won’t be displayed, some of them:

  • texturing enabled at all? (glEnable(GL_TEXTURE_2D)
  • all texture environment settings are correct?
  • maybe the call to glTexImage2D is not correct?
  • maybe the geometrive primitive in which the textue should be drawed on is not visible at all due to depth test reasons, or wrong matrix settings, etc.

and so on. What I would do, I would render a screen sized quad with orthographic projection (look for glOrtho2D and gluOrth2D) without a texture, but colored, and make sure that this is visible, and after that, put the texture on it… should be rather easy. If you already do that and it doesn’t work (the quad is shown but not the texture), post your texturing related code.

Jan

i tried the gluortho2d thing and yes i CAN see the black QUAD over the opengl application, but still no texture on it. Here in my code, but for what i can see it is 100% standard:

glPushMatrix();
glViewport(0,0,1280,768);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(0,1280,768,0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glScalef(1.0,1.0,1.0);

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,textures[0].texID);

//glColor4f(0.0,0.0,0.0,0.0);

glColor3f(0.0,0.0,0.0);
glBegin(GL_QUADS);
glTexCoord2f(0.0,0.0);
glVertex2i(50,50);

glTexCoord2f(1.0,0.0);
glVertex2i(50,500);

glTexCoord2f(1.0,1.0);
glVertex2i(500,500);

glTexCoord2f(0.0,1.0);
lVertex2i(500,50);
glEnd();

glDisable(GL_TEXTURE_2D);
glScalef(1.2,1.2,1.0);
//*/

glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glScalef(1.2, 1.2, 0.0);

i am quite sure that i have actually loaded the texture (even if i’d like to know if there is a safe way to check that without using just a bunch of sucking printf). The same loader with the same image (and the same opengl chunk i have displayed above) works fine on another opengl app that i have writed all by myself.
Anyway, just to be sure i put also the texture generation code so maybe u can find what’s wrong with it…

glGenTextures(1, &texture[0].texID); // Generate OpenGL texture IDs

    glBindTexture(GL_TEXTURE_2D, texture[0].texID);         // Bind Our Texture

    if (texture[0].bpp==24)                                                                 // Was The TGA 24 Bits
    {
            type=GL_RGB;                                                                            // If So Set The 'type' To GL_RGB
    }

    glTexImage2D(GL_TEXTURE_2D, 0, type, texture[0].width, texture[0].height, 0, type, GL_UNSIGNED_BYTE, texture[0].imageData);

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);   // Linear Filtered
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);       // Linear Filtered
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_REPEAT);

well what more can i say, but thanks 4 the attention? maybe just the promise to offer u a beer if u stop here anytime
Bye the Gunslinger

Try add this somewhere in your setup:

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE)

By default, the texture environment is set to GL_MODULATE, which causes the texture color to blend with the color of the polygon. In this case, you are setting your color to black, so your quad will be black. (0,0,0 * any other color = 0,0,0)

You could also try setting the color of your quad to full white.

[This message has been edited by Deiussum (edited 11-03-2003).]

thank u pals,
i managed to solve that without textures (man i love brute force ).
thanks to everybody the Gunslinger

So what exactly now did you do?

well i used the pixel table of the image to draw it pixel per pixel over the second application…
something like

for (image height)
for (image width)
if (pixel is black)
glBegin(GL_POINTS)
draw single pixel
glEnd()

just to keep perf impact low i put that in a display list and that’s all, no texture at all. no really smooth, but as long as it works…
bye bye the Gunslinger