Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 黑莓手机上的RGB 565格式_Java_Blackberry_Opengl Es - Fatal编程技术网

Java 黑莓手机上的RGB 565格式

Java 黑莓手机上的RGB 565格式,java,blackberry,opengl-es,Java,Blackberry,Opengl Es,在示例代码中,RIM将位图视为已存在,而不是桌面上常见的位图 例如: 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); 然而,磁盘上的位图是88

在示例代码中,RIM将位图视为已存在,而不是桌面上常见的位图

例如:

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字节吗?

好的,我想我知道了

GLUtils.glTexImage2D(gl, 0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, bitmap, null);
这是可行的,尽管它看起来不应该这样做(如果需要,函数似乎会自动将
位图
视为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,java.nio.Buffer))比GLUtils版本低一点。

只需确保它在设备上也能正常工作即可。特别是在处理OpenGL时,该设备的行为方式与模拟器不同。