在示例代码中,RIM将位图视为565 RGB format中的位图,而不是桌面上常见的8888 ARGB format,
例如:
net.rim.device.api.system.Bitmap bitmap =
net.rim.device.api.system.Bitmap.getBitmapResource( "BlackBerry.png" );
GLUtils.glTexImage2D(gl, 0, GL10.GL_RGB, GL10.GL_UNSIGNED_SHORT_5_6_5, bitmap, null);
磁盘上的位图是8888 ARGB - 为什么示例代码使用565 RGB,我可以使用8888 ARGB,每像素4个字节,而不是每像素2个字节?
答案 0 :(得分:0)
好吧,我知道了。
GLUtils.glTexImage2D(gl, 0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, bitmap, null);
虽然它看起来不应该有效(如果需要,该函数似乎会自动将Bitmap
视为R5G6B5,如果需要则自动将其视为A8R8G8B8。)
还有glTexImage2D(http://www.blackberry.com/developers/docs/5.0.0api/javax/microedition/khronos/opengles/GL10.html#glTexImage2D(int,int,int,int,int,int ,int,int,java.nio.Buffer))这个级别比GLUtils版本低一点。