NeHe OpenGL Lesson29 – Blitter Function, RAW Texture Loading

screen_shot12-300x210 This samples shows us how to load raw texture (or customized texture format file) and image alpha blend, image copy operations (namely Blitter function).
When I got into the source code, I found several thing that we could do to improve this sample.
1) use fread to read a block of data instead of fgetc to read one character by one character; Reading a big block (of course a certain size) should be much faster than read one by one. Actually, we will create some disc read cache buffer or DVD reading cache buffer to improve the reading speed at the application level on some lower access speed device. Also we need to care about that some operating system level API provide some system file cache function.
2) The Blitter function used here is very proto-type. For more advanced features, we could ask more special libraries like FreeImage, SDL and so on.
3) Use hard coding Blitter for texture is not  a good idea. Usually, we would like to paint well in PS, then apply them into the game.
4) For texture data, it is much better if we apply some compress format. Like DXT1 or DXT5, for this we could get less disc space usage and less memory usage.

 

For more details, you could check the source code from here.

posted @ 2012-08-23 20:41  opencoder  阅读(227)  评论(0编辑  收藏  举报