Oh yeah, there's also that approach. As a matter of fact, actually my
current rendering engine already can blit sprites from an image file with
multiple sprite images inside it. But I determined that the sprite images
in the BMP file must be of the same width and height (eg. all must be
16x16, 40x30, etc). I use this to blit my bitmap fonts. This probably will
make the 2D artist complains. Well thanks anyway.
Sean Middleditch said:
> On Mon, 2007-07-16 at 22:08 -0700, Mike Powell wrote:
>> benang@xxxxxxxxxxxx wrote:
>> > 4. AFAIK, to add a texture, the width & height of the image should be
>> > power of 2. So how do I make a sprite with width and/or height not of
>> > power of 2?
>> This was true in the old versions of OpenGL, but I know it's been
>> fixed by OpenGL 2.0. Not sure, offhand, exactly which version made the
>> shift, but if your version is up to date, you should be able to use
>> any texture size. Provided, of course, it's not larger then your
>> implementation's maximum texture size. These days, that's usually
>> either 512 or 1024, so you probably won't have a problem there.
> I think OpenGl 1.5 also has this restriction removed, and it's quite
> possible the driver supports 1.5 but not 2.0. (2.0 makes GLSL
> There are various things you can do to alleviate the texture
> limitations, though. One trick is to pack multiple
> tiles/images/textures into a single OpenGL texture, which if done
> carefully, will let you use a max sized texture with little wasted
> space. You then just have to remember the texture ID, width, height,
> x/s offset, and y/t offset of your image in the texture, and pass those
> various parameters in when rendering your quads. It can also help to
> just design your graphics around powers of two dimensions if at all
> possible. Especially if you're making a tile-based game and not some
> other kind of app, splitting up your tiles into smaller 16x16 or 32x32
> bits would be a good idea. (Few people realize this, but the tiles in
> old 2D Nintendo games were actually very very small - most of the tile
> "rips" you find online don't actually rip the tiles, but larger squares
> made of multiple tiles, so a lot of people think they're bigger than
> they really are.)
>> SDL mailing list
> Sean Middleditch <elanthis@xxxxxxxxxxxxxxx>
> SDL mailing list
Fare thee well,
Bawenang R. P. P.
ERROR: Brain not found. Please insert a new brain!
?Do nothing which is of no use.? - Miyamoto Musashi.
"I live for my dream. And my dream is to live my life to the fullest."
SDL mailing list