PDA

View Full Version : RGB



ramana
01-01-2004, 08:55 PM
In my machine when I am using RGBA(8-8-8-8), the h/w acceleration is not supported. Where as when I use RGBA(8-8-8-0) the h/w acceleration is supported and my application runs very very fast. But I want to display the RGB image in transparent on the screen without using RGBA. Means I can choose one color as a Transparent color in RGB image. Is it possible to display transparent RGBs without RGBA.

Zengar
01-01-2004, 11:45 PM
You don't need framebuffer alpha to display transparent textures. Look into glblendFunc and glAlphaFunc.

ramana
01-05-2004, 01:59 AM
I want to display one .BMP image on the screen. I am using RGB(8-8-8-0) Mode. My image cotains BLACK color as the background color. And I want to display the image excluding this BLACK color. What is the Blend function for this one. Presently I am using
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRCALPHA);



[This message has been edited by ramana (edited 01-05-2004).]

dorbie
01-05-2004, 02:18 AM
That is the correct blend function. But you don't even need a blend function for your case, you still need alpha though.

Try using alpha testing and no blending for faster results on many platforms.

glDisable(GL_BLEND);
glAlphaFunc(GL_GREATER, 0.0f);
glEnable(GL_ALPHA_TEST);

This should be fast even in software although I suspect your problem may be that you're using glDrawPixels and so you'd need to draw your image using texture for an optimized path.

Try loading the image as a texture and drawing on a quad with a GL_REPLACE texture environment, drawpixels is not very fast on some implementations, especially if you do things like blend pixels. If you're running in software when you use texture also use a GL_NEAREST texture filter for min & max, this texture path is definitely optimized for software rendering in the fallback libs.