NeHe OpenGL Lesson29 – Blitter Function, RAW Texture Loading

本文探讨了如何加载原始纹理及自定义纹理格式文件,并介绍了图像Alpha混合与复制操作(Blitter函数)。文中提出改进点:使用fread提高读取速度,考虑系统级文件缓存;建议使用如FreeImage等库增强Blitter功能;避免硬编码Blitter,提倡使用专业软件进行纹理设计;采用压缩格式如DXT1或DXT5减少磁盘和内存占用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.

转载于:https://www.cnblogs.com/open-coder/archive/2012/08/23/2653229.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值