Graphics in 2D Adventures

Started by
3 comments, last by IndyJones 20 years, 2 months ago
Hey! I''m currently developing an Engine for a 2D Adventure. Now I came to the point of implementing Graphics and the following question arised: How to do graphics for a 2D Adventure in a 3D API. I came to two approaches: 1. Using Textures Advantage: - Ability of using hardware functions (like alpha blending) - They are faster than method 2. Disadvantage: - Images must have a size of 2^x (so if I have a character in my game I''d have to split him into 3 32x32 textures for instance) 2. Using "Blitting" (Surfaces in DX or glDrawBuffer in OGL) Advantage: - The image size doesn''t matter Disadvantage: - Slow (stalls the hardware) - No hardware alpha blending/filtering Personally I''d go for solution 1 but I wanted to hear your opinions on this topic first. How is this done in commercial games from this genre? Thx in advance
Advertisement
On 3D hardware you should definitely go with option #1. The power of two thing isn''t that big of a problem, especially considering most newer (Geforce\Geforce2+ ?) graphics cards can actually accept non power of two textures, although there may be a decent amount of distortion. I think they handle it by having the drivers rescale the image, I''m not entirely sure on this one though, some cards may support it directly in hardware. I''ve used non-power of 2 textures for sprites and it doesn''t look bad.
Your single disadvantage for 1) is no disadvantage at all. Pack animation frames into each texture and use different texture coordinates. Even without animation, if you had a 32x96 character, just put it into a 32x128 texture.

Personally I go for 1), I am quite happy requiring at least minimal level of 3D hardware acceleration (basically OpenGL 1.1 or the equivalent D3D8.1 caps) in exchange for fast blending, filtering and z-buffering.
Thx guys for pointing me in the right direction
One thing that I have never understood is why the power of 2 rule for textures is such a big deal? If you need an image that doesn''t match 2^x then why not just use alpha blending or a color key to mask out the part of the texture you don''t want to use?

Webby

This topic is closed to new replies.

Advertisement