Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Bitmaps in opengl. how to filter the background


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Hayato   Members   -  Reputation: 124

Like
Likes
Like

Posted 23 September 2001 - 02:57 PM

I saw nehe''s program on how to move bitmaps in 3d space but like, how did it know to filter out the black background? There is that linear filtering but I doubt that does it. Also, do you need to put the bitmap/texture onto a surface? I saw the glDrawPixels() that can draw bitmaps.. but hmm, i dont know. Please help me!! thanks!

Sponsor:

#2 Drizzt DoUrden   Members   -  Reputation: 100

Like
Likes
Like

Posted 23 September 2001 - 03:03 PM

WHen you say filter, do you mean take away the surrounding black/white around the actual image ( bitmap )?

"I''ve sparred with creatures from the nine hells themselves... I barely plan on breaking a sweat here, today."~Drizzt Do''Urden

#3 Hayato   Members   -  Reputation: 124

Like
Likes
Like

Posted 23 September 2001 - 03:05 PM

ya! exactly what i mean

#4 Drizzt DoUrden   Members   -  Reputation: 100

Like
Likes
Like

Posted 23 September 2001 - 03:14 PM

You use blending for that.

"I''ve sparred with creatures from the nine hells themselves... I barely plan on breaking a sweat here, today."~Drizzt Do''Urden

#5 Null and Void   Moderators   -  Reputation: 1087

Like
Likes
Like

Posted 23 September 2001 - 03:18 PM

Either load an image with an alpha channel already in it, or add the alpha channel as it''s being loaded by testing if the pixel is a certain color. Then you render while blending or alpha testing, as has been stated.

[Resist Windows XP''s Invasive Production Activation Technology!]

#6 Hayato   Members   -  Reputation: 124

Like
Likes
Like

Posted 23 September 2001 - 03:20 PM

The blend function huh?

Doesn''t that juat make everything transparent depending on the alpha value and etc.

So what you are saying is, if i make a series of bitmaps with black backgrounds AND i use the blend function, opengl will automatically know that the black part in the bitmaps are just backgrounds?

if i were to use white backgrounds, opengl will NOT filter the white part right?

#7 Null and Void   Moderators   -  Reputation: 1087

Like
Likes
Like

Posted 23 September 2001 - 03:33 PM

No, it would not know that (at least not with the type of blending you''d want). You have to input one byte for every three that you load (a runtime created alpha value) to tell it whether that pixel is transparent or not. So what you do is: Read a pixel from the file, test if it is black (or whatever), if yes add a 0x00 alpha value, if no add a 0xFF alpha value, repeat until image is loaded.

[Resist Windows XP''s Invasive Production Activation Technology!]

#8 Hayato   Members   -  Reputation: 124

Like
Likes
Like

Posted 23 September 2001 - 03:40 PM

ahh, just like in directx!! i see, thanks.

#9 zedzeek   Members   -  Reputation: 528

Like
Likes
Like

Posted 23 September 2001 - 06:54 PM

also for extra speed dont use blend but use the alpha test
glEnable( GL_ALPHA_TEST );
glAlphaFunc( GL_GREATER, 0 );

ok so all pixels with an alpha of 0 will not get drawn , all the others will




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS