Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Lemon Boy

OpenGL Bitmaps Limited in openGL

This topic is 5300 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys (and gals) theses is my second post since i signed up yesterday and so far a great help any who, in the Nehe bitmap loader examples (in the tuts) we have this lame rule bout the bitmap having to be more than 32 pixles and less than 256 pixels, and that the bitmap has to be divisalbe by 2. is there any way round this its just im making a 2d RPG engine and i need the most funcalty i can get (its my dissertation). so any help would be great i also noticed that when i alpha blend a bitmap to remove the black border (via NeHe tuts) the rest of it looks semi transpartent (this looks kinda funny with a character on a map)is there any way round this? i tried nehe''s TGA code but its doestnt seem to load any of my textures and i dont know why. ANY help on diffrent ways to combat EITHER of my problems will be very much appreaicted! thanx L.B.

Share this post


Link to post
Share on other sites
Advertisement
NeHe''s TGA loader only loads uncompressed 24 or 32 bit TGA files. Check your TGAs to make sure they are not compressed. Also, some programs don''t save the Alpha channel properly so they will be screwed up looking in the NeHe tutorials.

Yes textures are limited to be a square that is the power of 2. I am not sure about the minimum, but the maximum is now 1024x1024.

If you need a texture that is not a standard size, just put it in the smallest square that it will fit into and then make the texture coordinates to pick your image.

ie


0.0,1.0 1.0,1.0
-------------
| |
| |
0.0,0.5 |-----------|1.0,0.5
| |
| |
-------------
0.0,0.0 1.0,0.0

0.5,1.0
------------
| /\ |
| / \ |
| / \ |
| / \ |
|/ \|
------------
0.0,0.0 1.0,0.0


You don''t have to display the whole texture, you could display the top half, or the middle or top left. Basically any polygon shape.



First make it work, then make it fast. --Brian Kernighan

The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities. We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)

Do not interrupt your enemy when he is making a mistake. - Napolean Bonaparte

Share this post


Link to post
Share on other sites
IIRC, there are OpenGL extensions which allow non-power-of-2 texture sizes

I''ve never used them, however.

Share this post


Link to post
Share on other sites
The problem with your alpha blending is easily solved by masking
This technique is devoted a lesson on NeHe, just go there!

Share this post


Link to post
Share on other sites
They do not have to be square, but they do have to be power of 2.

you can have a 16x512 texture no problem. And some of the newer GFX cards can go up to 4096x4096 I think.


Waramp.

"Before you insult a man, walk a mile in his shoes.
That way, when you do insult him, you''ll be a mile away, and you''ll have his shoes."

Share this post


Link to post
Share on other sites
quote:
Original post by Lemon Boy
Hey guys (and gals)
theses is my second post since i signed up yesterday and so far a great help

any who, in the Nehe bitmap loader examples (in the tuts) we have this lame rule bout the bitmap having to be more than 32 pixles and less than 256 pixels, and that the bitmap has to be divisalbe by 2. is there any way round this its just im making a 2d RPG engine and i need the most funcalty i can get (its my dissertation). so any help would be great

i also noticed that when i alpha blend a bitmap to remove the black border (via NeHe tuts) the rest of it looks semi transpartent (this looks kinda funny with a character on a map)is there any way round this?
i tried nehe''s TGA code but its doestnt seem to load any of my textures and i dont know why.

ANY help on diffrent ways to combat EITHER of my problems will be very much appreaicted!
thanx
L.B.


Your post displays a number of errors which indicate that you didn''t bother to read the OpenGL docs before asking this question, and have probably misread nehe''s tutorials to boot. Please do some research before asking questions. The sections in the OpenGL programming guide on alpha blending and texture mapping will answer your question. See the Forum FAQ for a link.

Share this post


Link to post
Share on other sites
quote:
Original post by WarAmp
you can have a 16x512 texture no problem. And some of the newer GFX cards can go up to 4096x4096 I think.



Nvidia''s ones can, ATI cards have a max of 2048*2048

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!