views:

194

answers:

1

i am writing a 2d lib which will have 3d acceleration but i'd like to do it in a way that it will efficiently run on older HW. Possibly typedefs to hide options/functions that your targeted mode does not support. (also there may be emulation func turned on)

What are some of the things older HW do? here is a list of questions and things i know of.

  • Tiles, this will be unsupported. Its to old, my lib will support pixel access
  • Single pixel buffer with scrolling. Example GBA
  • multiple surface with surface to surface quick blt (no stretch)
  • multiple surface with surface to surface quick blt with stretch (maybe this was emulated? does any HW stretch images for you?)
  • HW pixel fill (i thought i saw the option in DX)
  • HW transparent colour? (colour which is transparent, thought i seen in DX specs)
  • Textures, older use to be a power of 2. The width does not have to be the same power of 2 as height? (example 64x256), does any require them to be the same
  • Textures, newer HW can have them any width and height (or is this a lie?)
  • Textures can be in crazy formats (ARGB 8888, ABGR 8888, ABGR 2 10 10 10)

Also, i cannot do a texture to texture blit? as in copy 60x40 from texture A to B in HW ? Also can textures be in palette? (i wont support this) and finally i should keep in mind about shaders 8)

What else am i missing?

+1  A: 

What 3D accelleration are you referring to? If it is OpenGL compatible hardware:

  • Textures need to be power of 2, width and height can have arbitrary power of two.
  • Textures without power of 2 constraint are enabled with an openGL extension which you can test for (and is present on almost all new hardware).
  • Several different texture formats are standardized in OpenGL, I don't know extensions to have arbitrary texture formats.

About 2D:

  • Normal hardware 2D acceleration supports blitting, but not stretching. Stretching is available as "video acceleration". For example, in X11 you can use the xv extension to get accelerated stretching, but only in YUV color space.
  • For really fast image drawing operations, check out Imlib2. It does everything in software, but blazingly fast. Perhaps the right way to go if 3D hardware acceleration is not available. 2D hw acceleration differs in performance, and for example the X11 RENDER acceleration is often beaten by Imlib2. http://docs.enlightenment.org/api/imlib2/html/

An interesting project for you to look at could also be DirectFB, which tries to heavily use HW 2D acceleration: http://www.directfb.org/

ypnos