Transparent Pixel

Transparent Pixel

Post by Dave Shreine » Fri, 04 Apr 1997 04:00:00



Hi,

   It sounds like you should be using alpha blending, as compared
to a transparent pixel.  From my limited understanding, the
transparent pixel extension nominates a normal RGB color to become
transparent.  I suspect that this is not what you really are looking
for.

   First, overlay planes are usually color indexed ( I know there
aren't any RGB overlays on SGI's ... not sure about other platforms ),
so there's not alpha channel supported.

   For what you describe, I'll assume you're putting up some type
of small image symbology.  In the places where you don't want anything
to appear, set the alpha value of the RGBA pixel to 0.0.  You then
have two choices:

   - If you want blending of the colors, that is, the symbology to
        blend into the image, then use glBlendFunc() and enable
        GL_BLEND.

   - If you want to reject any pixel which is transparent, then use
        glAlphaTest(), and enable GL_ALPHA_TEST.  This will permit
        you to low or high pass filter the pixel's transparency.

   Hope that helps.

Thanx,
Dave

  ---------------------------------------------------------------------


   Silicon Graphics, Inc.                            (301) 572-3290

 
 
 

Transparent Pixel

Post by Mark Kilga » Sat, 05 Apr 1997 04:00:00


|>
|> I have a SGI O2 and I am trying to get a transparent pixel that is not in
|> the overlay plane. Basically, I am trying to draw translucent annotation
|> on top of an image that is display with SGI's ImageVision(ilVkViewer). My
|> first try was drawing in the overlay plane but since there is no alpha
|> channel I was not able to easily achieve translucency. Now I am trying to
|> use an OpenGL drawing widget with a RGBA color model with a transparent
|> background that is on top of my ilVkViwer in a form widget. As far as I
|> can tell the RGBA color model is not supported in the overlay plane?? Is
|> there a way to have a transparent pixel in the RGBA color model?? SGI
|> documentation states the follow:

You don't want overlay transparency; you want alpha blended
transparency.

What you should do is render your lower image, and then
render your alpha-blended text on top.

Here's the idea:

   render_main_image();
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
   glEnable(GL_BLEND);
   glColor4f(1.0, 0.0, 0.0, 0.5);  /* 50% red */

   /* Draw text */
   glRasterPos2f(x, y);
   len = (int) strlen(string);
   for (i = 0; i < len; i++) {
      /* This routine just calls glBitmap with a font character. */
      glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_10, string[i]);
   }

   /* Disable Blending when done. */
   glDisable(GL_BLEND);

If you want to understand better what I'm describing, see my
book "Programming OpenGL for the X Window System" (Addison-Wesley,
ISBN 0-201-48359-9).  It has a section on blending and describes
the GLUT routine I use above:  For more info, see:

  http://reality.sgi.com/mjk_asd/OpenGLforX.html

I hope this helps.

- Mark

 
 
 

1. Transparent pixels in GIF image

How do I make parts of an image transparent so that overlaying it
over an existing image (like a GIF image on top of another GIF background
image in Netscape) doesn't hide all the background?  For example, if I
want a circle, I don't want a square containing the circle overlayed
but just the circle itself.  Some images seem to work and some seem not
to.

Can anyone tell me how to do this?


Thanks,  Karl

2. 101 uses for a LightWave manual.

3. transparent pixels

4. screen color independant image

5. Change Canvas to Transparent Pixels

6. Quantitative measure of image degradation

7. sorting error with polys that have transparent pixels

8. Alpha Test - Transparent Pixels

9. z-buffering completely transparent pixels

10. copy non-transparent pixels from bitmap to bitmap

11. Making a filter plugin: what to do with transparent pixels??

12. Netscape Gif Pixel Transparent flag